pytestCheckHook: Add disabledTestFiles option

launchpad/nixpkgs/master
Sandro Jäckel 3 years ago committed by Jonathan Ringer
parent 2982fa466e
commit 6f7f01a244
  1. 4
      doc/languages-frameworks/python.section.md
  2. 8
      pkgs/development/interpreters/python/hooks/pytest-check-hook.sh

@ -610,6 +610,10 @@ Using the example above, the analagous pytestCheckHook usage would be:
"download"
"update"
];
disabledTestFiles = [
"tests/test_failing.py"
];
```
This is expecially useful when tests need to be conditionallydisabled,

@ -2,6 +2,7 @@
echo "Sourcing pytest-check-hook"
declare -ar disabledTests
declare -ar disabledTestFiles
function _concatSep {
local result
@ -36,6 +37,13 @@ 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"
exit 1
fi
args+=" --ignore=$file"
done
args+=" ${pytestFlagsArray[@]}"
eval "@pythonCheckInterpreter@ $args"

Loading…
Cancel
Save