mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-12 20:55:31 +03:00
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:
parent
e8f3fe8c6e
commit
26f09762a8
3 changed files with 40 additions and 24 deletions
|
@ -1273,7 +1273,7 @@ Using the example above, the analogous `pytestCheckHook` usage would be:
|
|||
];
|
||||
|
||||
# requires additional data
|
||||
pytestFlagsArray = [
|
||||
pytestFlags = [
|
||||
"tests/"
|
||||
"--ignore=tests/integration"
|
||||
];
|
||||
|
@ -2002,7 +2002,7 @@ Occasionally packages don't make use of a common test framework, which may then
|
|||
|
||||
* Non-working tests can often be deselected. Most Python modules
|
||||
do follow the standard test protocol where the pytest runner can be used.
|
||||
`pytest` supports the `-k` and `--ignore` parameters to ignore test
|
||||
`pytest` supports the `-k` and `--ignore-glob` parameters to ignore test
|
||||
methods or classes as well as whole files. For `pytestCheckHook` these are
|
||||
conveniently exposed as `disabledTests` and `disabledTestPaths` respectively.
|
||||
|
||||
|
@ -2019,11 +2019,17 @@ Occasionally packages don't make use of a common test framework, which may then
|
|||
];
|
||||
|
||||
disabledTestPaths = [
|
||||
"this/file.py"
|
||||
"path/to/performance.py"
|
||||
"path/to/connect-*.py"
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
::: {.note}
|
||||
If the test path to disable contains characters like `*`, `?`, `[`, and `]`,
|
||||
quote them with square brackets (`[*]`, `[?]`, `[[]`, and `[]]`) to match literally.
|
||||
:::
|
||||
|
||||
* Tests that attempt to access `$HOME` can be fixed by using the following
|
||||
work-around before running tests (e.g. `preCheck`): `export HOME=$(mktemp -d)`
|
||||
* Compiling with Cython causes tests to fail with a `ModuleNotLoadedError`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue