python3Packages.pytestCheckHook: Make disabledTests support sub-expressions

Wrap each elements of disabledTests with parenthesis
so that when __structuredAttrs = true,
people could use sub-expressions an element.

E.g.
```nix
{
  disabledTests = [
    "ClassFoo and test_foo"
    "test_bar"
  ];
}
This commit is contained in:
Yueh-Shun Li
2025-03-23 23:10:09 +08:00
parent 4174f6ed5c
commit f51e1c6766
2 changed files with 10 additions and 1 deletions
@@ -170,6 +170,14 @@ in
"test_print"
] ++ previousPythonAttrs.disabledTests or [ ];
});
disabledTests-expression = objprint.overridePythonAttrs (previousPythonAttrs: {
__structuredAttrs = true;
pname = "test-pytestCheckHook-disabledTests-expression-${previousPythonAttrs.pname}";
disabledTests = [
"TestBasic and test_print"
"test_str"
] ++ previousPythonAttrs.disabledTests or [ ];
});
disabledTestPaths = objprint.overridePythonAttrs (previousPythonAttrs: {
pname = "test-pytestCheckHook-disabledTestPaths-${previousPythonAttrs.pname}";
disabledTestPaths = [
@@ -57,7 +57,8 @@ EOF
done
if [ -n "${disabledTests[*]-}" ]; then
disabledTestsString="not $(concatStringsSep " and not " disabledTests)"
# not (keyword1) and not (keyword2)
disabledTestsString="not ($(concatStringsSep ") and not (" disabledTests))"
flagsArray+=(-k "$disabledTestsString")
fi