From d6d63aef7d7fcb8df2611717fee6311f75fc63e3 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Sun, 14 Feb 2021 23:54:55 +0100 Subject: [PATCH] pytestCheckHook: add support for disabling arbitrary paths Renames `disabledTestFiles` to the more genereric `disabledTestPaths` to reflect that change. --- doc/languages-frameworks/python.section.md | 2 +- .../interpreters/python/hooks/pytest-check-hook.sh | 10 +++++----- pkgs/development/python-modules/cheroot/default.nix | 2 +- pkgs/development/python-modules/slixmpp/default.nix | 2 +- pkgs/development/python-modules/starlette/default.nix | 2 +- pkgs/development/python-modules/typesystem/default.nix | 2 +- pkgs/development/python-modules/virtualenv/default.nix | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/doc/languages-frameworks/python.section.md b/doc/languages-frameworks/python.section.md index 71193ed0cc0b..f36f5cf0cbb9 100644 --- a/doc/languages-frameworks/python.section.md +++ b/doc/languages-frameworks/python.section.md @@ -611,7 +611,7 @@ Using the example above, the analagous pytestCheckHook usage would be: "update" ]; - disabledTestFiles = [ + disabledTestPaths = [ "tests/test_failing.py" ]; ``` diff --git a/pkgs/development/interpreters/python/hooks/pytest-check-hook.sh b/pkgs/development/interpreters/python/hooks/pytest-check-hook.sh index 85811a374755..eb45205ff731 100644 --- a/pkgs/development/interpreters/python/hooks/pytest-check-hook.sh +++ b/pkgs/development/interpreters/python/hooks/pytest-check-hook.sh @@ -2,7 +2,7 @@ echo "Sourcing pytest-check-hook" declare -ar disabledTests -declare -ar disabledTestFiles +declare -ar disabledTestPaths function _concatSep { local result @@ -37,12 +37,12 @@ function pytestCheckPhase() { disabledTestsString=$(_pytestComputeDisabledTestsString "${disabledTests[@]}") args+=" -k \""$disabledTestsString"\"" fi - for file in ${disabledTestFiles[@]}; do - if [ ! -f "$file" ]; then - echo "Disabled test file \"$file\" does not exist. Aborting" + for path in ${disabledTestPaths[@]}; do + if [ ! -e "$path" ]; then + echo "Disabled tests path \"$path\" does not exist. Aborting" exit 1 fi - args+=" --ignore=\"$file\"" + args+=" --ignore=\"$path\"" done args+=" ${pytestFlagsArray[@]}" eval "@pythonCheckInterpreter@ $args" diff --git a/pkgs/development/python-modules/cheroot/default.nix b/pkgs/development/python-modules/cheroot/default.nix index e5c7c23e2e43..4d6c71a7e2a5 100644 --- a/pkgs/development/python-modules/cheroot/default.nix +++ b/pkgs/development/python-modules/cheroot/default.nix @@ -73,7 +73,7 @@ buildPythonPackage rec { "bind_addr_unix" ]; - disabledTestFiles = [ + disabledTestPaths = [ # avoid attempting to use 3 packages not available on nixpkgs # (jaraco.apt, jaraco.context, yg.lockfile) "cheroot/test/test_wsgi.py" diff --git a/pkgs/development/python-modules/slixmpp/default.nix b/pkgs/development/python-modules/slixmpp/default.nix index 341f53cfe0b5..f648905251e2 100644 --- a/pkgs/development/python-modules/slixmpp/default.nix +++ b/pkgs/development/python-modules/slixmpp/default.nix @@ -39,7 +39,7 @@ buildPythonPackage rec { checkInputs = [ pytestCheckHook ]; # Exclude live tests - disabledTestFiles = [ "tests/live_test.py" ]; + disabledTestPaths = [ "tests/live_test.py" ]; pythonImportsCheck = [ "slixmpp" ]; diff --git a/pkgs/development/python-modules/starlette/default.nix b/pkgs/development/python-modules/starlette/default.nix index 94513e5d620c..071bbcd3061a 100644 --- a/pkgs/development/python-modules/starlette/default.nix +++ b/pkgs/development/python-modules/starlette/default.nix @@ -50,7 +50,7 @@ buildPythonPackage rec { typing-extensions ]; - disabledTestFiles = [ "tests/test_graphql.py" ]; + disabledTestPaths = [ "tests/test_graphql.py" ]; # https://github.com/encode/starlette/issues/1131 disabledTests = [ "test_debug_html" ]; pythonImportsCheck = [ "starlette" ]; diff --git a/pkgs/development/python-modules/typesystem/default.nix b/pkgs/development/python-modules/typesystem/default.nix index e93fd83656f8..c278680404ba 100644 --- a/pkgs/development/python-modules/typesystem/default.nix +++ b/pkgs/development/python-modules/typesystem/default.nix @@ -35,7 +35,7 @@ buildPythonPackage rec { # the default string formatting of regular expression flags which breaks test assertion "test_to_json_schema_complex_regular_expression" ]; - disabledTestFiles = [ + disabledTestPaths = [ # for some reason jinja2 not picking up forms directory (1% of tests) "tests/test_forms.py" ]; diff --git a/pkgs/development/python-modules/virtualenv/default.nix b/pkgs/development/python-modules/virtualenv/default.nix index 8b64bddc5a4f..6d2c19d36750 100644 --- a/pkgs/development/python-modules/virtualenv/default.nix +++ b/pkgs/development/python-modules/virtualenv/default.nix @@ -69,7 +69,7 @@ buildPythonPackage rec { ''; # Ignore tests which require network access - disabledTestFiles = [ + disabledTestPaths = [ "tests/unit/create/test_creator.py" "tests/unit/seed/embed/test_bootstrap_link_via_app_data.py" ];