pytestCheckHook: add support for disabling arbitrary paths

Renames `disabledTestFiles` to the more genereric `disabledTestPaths` to
reflect that change.
This commit is contained in:
Martin Weinelt 2021-02-14 23:54:55 +01:00
parent 056f697397
commit d6d63aef7d
No known key found for this signature in database
GPG Key ID: 87C1E9888F856759
7 changed files with 11 additions and 11 deletions

View File

@ -611,7 +611,7 @@ Using the example above, the analagous pytestCheckHook usage would be:
"update" "update"
]; ];
disabledTestFiles = [ disabledTestPaths = [
"tests/test_failing.py" "tests/test_failing.py"
]; ];
``` ```

View File

@ -2,7 +2,7 @@
echo "Sourcing pytest-check-hook" echo "Sourcing pytest-check-hook"
declare -ar disabledTests declare -ar disabledTests
declare -ar disabledTestFiles declare -ar disabledTestPaths
function _concatSep { function _concatSep {
local result local result
@ -37,12 +37,12 @@ function pytestCheckPhase() {
disabledTestsString=$(_pytestComputeDisabledTestsString "${disabledTests[@]}") disabledTestsString=$(_pytestComputeDisabledTestsString "${disabledTests[@]}")
args+=" -k \""$disabledTestsString"\"" args+=" -k \""$disabledTestsString"\""
fi fi
for file in ${disabledTestFiles[@]}; do for path in ${disabledTestPaths[@]}; do
if [ ! -f "$file" ]; then if [ ! -e "$path" ]; then
echo "Disabled test file \"$file\" does not exist. Aborting" echo "Disabled tests path \"$path\" does not exist. Aborting"
exit 1 exit 1
fi fi
args+=" --ignore=\"$file\"" args+=" --ignore=\"$path\""
done done
args+=" ${pytestFlagsArray[@]}" args+=" ${pytestFlagsArray[@]}"
eval "@pythonCheckInterpreter@ $args" eval "@pythonCheckInterpreter@ $args"

View File

@ -73,7 +73,7 @@ buildPythonPackage rec {
"bind_addr_unix" "bind_addr_unix"
]; ];
disabledTestFiles = [ disabledTestPaths = [
# avoid attempting to use 3 packages not available on nixpkgs # avoid attempting to use 3 packages not available on nixpkgs
# (jaraco.apt, jaraco.context, yg.lockfile) # (jaraco.apt, jaraco.context, yg.lockfile)
"cheroot/test/test_wsgi.py" "cheroot/test/test_wsgi.py"

View File

@ -39,7 +39,7 @@ buildPythonPackage rec {
checkInputs = [ pytestCheckHook ]; checkInputs = [ pytestCheckHook ];
# Exclude live tests # Exclude live tests
disabledTestFiles = [ "tests/live_test.py" ]; disabledTestPaths = [ "tests/live_test.py" ];
pythonImportsCheck = [ "slixmpp" ]; pythonImportsCheck = [ "slixmpp" ];

View File

@ -50,7 +50,7 @@ buildPythonPackage rec {
typing-extensions typing-extensions
]; ];
disabledTestFiles = [ "tests/test_graphql.py" ]; disabledTestPaths = [ "tests/test_graphql.py" ];
# https://github.com/encode/starlette/issues/1131 # https://github.com/encode/starlette/issues/1131
disabledTests = [ "test_debug_html" ]; disabledTests = [ "test_debug_html" ];
pythonImportsCheck = [ "starlette" ]; pythonImportsCheck = [ "starlette" ];

View File

@ -35,7 +35,7 @@ buildPythonPackage rec {
# the default string formatting of regular expression flags which breaks test assertion # the default string formatting of regular expression flags which breaks test assertion
"test_to_json_schema_complex_regular_expression" "test_to_json_schema_complex_regular_expression"
]; ];
disabledTestFiles = [ disabledTestPaths = [
# for some reason jinja2 not picking up forms directory (1% of tests) # for some reason jinja2 not picking up forms directory (1% of tests)
"tests/test_forms.py" "tests/test_forms.py"
]; ];

View File

@ -69,7 +69,7 @@ buildPythonPackage rec {
''; '';
# Ignore tests which require network access # Ignore tests which require network access
disabledTestFiles = [ disabledTestPaths = [
"tests/unit/create/test_creator.py" "tests/unit/create/test_creator.py"
"tests/unit/seed/embed/test_bootstrap_link_via_app_data.py" "tests/unit/seed/embed/test_bootstrap_link_via_app_data.py"
]; ];