python3Packages.pytestCheckHook: support deselecting tests via disabledTestPaths
Pass disabledTestPaths elements containing double colons (::) to --deselect instead of --ignore-glob.
This commit is contained in:
@@ -184,6 +184,12 @@ in
|
||||
] ++ previousPythonAttrs.disabledTestPaths or [ ];
|
||||
})
|
||||
);
|
||||
disabledTestPaths-item = objprint.overridePythonAttrs (previousPythonAttrs: {
|
||||
pname = "test-pytestCheckHook-disabledTestPaths-item-${previousPythonAttrs.pname}";
|
||||
disabledTestPaths = [
|
||||
"tests/test_basic.py::TestBasic"
|
||||
] ++ previousPythonAttrs.disabledTestPaths or [ ];
|
||||
});
|
||||
disabledTestPaths-glob = objprint.overridePythonAttrs (previousPythonAttrs: {
|
||||
pname = "test-pytestCheckHook-disabledTestPaths-glob-${previousPythonAttrs.pname}";
|
||||
disabledTestPaths = [
|
||||
|
||||
@@ -13,8 +13,11 @@ function pytestCheckPhase() {
|
||||
local -a _pathsArray=()
|
||||
concatTo _pathsArray disabledTestPaths
|
||||
for path in "${_pathsArray[@]}"; do
|
||||
# Check if every path glob matches at least one path
|
||||
@pythonCheckInterpreter@ - "$path" <<EOF
|
||||
if [[ "$path" =~ "::" ]]; then
|
||||
flagsArray+=("--deselect=$path")
|
||||
else
|
||||
# Check if every path glob matches at least one path
|
||||
@pythonCheckInterpreter@ - "$path" <<EOF
|
||||
import glob
|
||||
import sys
|
||||
path_glob=sys.argv[1]
|
||||
@@ -23,7 +26,8 @@ if not len(path_glob):
|
||||
if next(glob.iglob(path_glob), None) is None:
|
||||
sys.exit('Disabled tests path glob "{}" does not match any paths. Aborting'.format(path_glob))
|
||||
EOF
|
||||
flagsArray+=("--ignore-glob=$path")
|
||||
flagsArray+=("--ignore-glob=$path")
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "${disabledTests[*]-}" ]; then
|
||||
|
||||
Reference in New Issue
Block a user