pytestCheckHook: support __structuredAttrs

Add flag pytestFlags as the new, conforming interface
replacing pytestFlagsArray.

Stop Bash-expanding disabledTests and disabledTestPaths.

Handle disabledTestPaths with `pytest --ignore-glob <path>`
to keep globbing support.
Check if each path glob matches at least one path
using the `glob` module from the Python standard library.

Also make buildPythonPackage and buildPythonApplication
stop escaping the elements of disabledTests and disabledTestPaths.
This commit is contained in:
Yueh-Shun Li
2025-01-09 18:36:37 +08:00
parent e8f3fe8c6e
commit 26f09762a8
3 changed files with 40 additions and 24 deletions
@@ -106,6 +106,7 @@ let
"format"
"disabledTestPaths"
"disabledTests"
"pytestFlags"
"pytestFlagsArray"
"unittestFlagsArray"
"outputs"
@@ -434,13 +435,14 @@ let
}
// optionalAttrs (attrs.doCheck or true) (
optionalAttrs (disabledTestPaths != [ ]) {
disabledTestPaths = escapeShellArgs disabledTestPaths;
disabledTestPaths = disabledTestPaths;
}
// optionalAttrs (attrs ? disabledTests) {
# `escapeShellArgs` should be used as well as `disabledTestPaths`,
# but some packages rely on existing raw strings.
disabledTests = attrs.disabledTests;
}
// optionalAttrs (attrs ? pytestFlags) {
pytestFlags = attrs.pytestFlags;
}
// optionalAttrs (attrs ? pytestFlagsArray) {
pytestFlagsArray = attrs.pytestFlagsArray;
}