24 Commits

Author SHA1 Message Date
Yueh-Shun Li 842f12f8ff python3Packages.pytestCheckHook: format with shfmt 2025-05-04 01:36:44 +08:00
Yueh-Shun Li 63dea02c93 python3Packages.pytestCheckHook: fix Bash heredoc EOF outside subshell
Fix the unterminated here document of the pytest-check-hook.sh
error mesage by moving the EOF of the here document
between the parenthesis of the process substitution.
2025-05-04 01:31:46 +08:00
Yueh-Shun Li e1e072bf03 python3Packages.pytestCheckHook: support enabledTestMarks and disabledTestMarks 2025-03-23 23:51:16 +08:00
Yueh-Shun Li f7aeb5a9b7 python3Packages.pytestCheckHook: support enabledTests 2025-03-23 23:51:16 +08:00
Yueh-Shun Li f51e1c6766 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"
  ];
}
2025-03-23 23:10:09 +08:00
Yueh-Shun Li 4174f6ed5c python3Packages.pytestCheckHook: support enabledTestPaths 2025-03-23 23:10:04 +08:00
Yueh-Shun Li 16f8b50742 python3Packages.pytestCheckHook: support deselecting tests via disabledTestPaths
Pass disabledTestPaths elements containing double colons (::)
to --deselect instead of --ignore-glob.
2025-03-09 22:20:16 +08:00
Yueh-Shun Li 6bdb735bbe python3Packages.pytestCheckHook: append disableTests flags after disabledTestPaths flags 2025-03-09 22:20:16 +08:00
Yueh-Shun Li 2e512e7cf7 python3Packages.pytestCheckHook: fix disabledTestPaths glob matching assertion
Errors in Bash's process substitution doesn't get propagated outside.

Replace the process substitution with Python's `-` as /dev/stdin and
Bash's heredoc stdin redirection.
2025-03-07 07:14:56 +08:00
Yueh-Shun Li ec6f585f05 pytestCheckHook: lint with ShellCheck 2025-01-09 18:36:37 +08:00
Yueh-Shun Li 26f09762a8 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.
2025-01-09 18:36:37 +08:00
Wolfgang Walther 56b09628e3 stdenv: support multi-char separators in concatStringsSep
One prominent use-case for this is pytestCheckHook. This will help
making it work with structuredAttrs in the future.
2024-11-30 16:38:02 +01:00
Yueh-Shun Li 57c2e5683d buildPython hooks: format with shfmt 2024-10-08 07:42:21 +08:00
Yueh-Shun Li 054c5f0e10 treewide: handle preDistPhases __structuredAttrs-agnostically
Always specify the preDistPhases attribute as a list instead of a string.

Append elements to the preDistPhases Bash variable using appendToVar
instead of string or Bash array concatenation.

Handle element insertion before a specific element using string
substitution as before, but handle both structured and unstructured
attributes.
2024-09-03 05:33:59 +08:00
Martin Weinelt 0b0dd33e0a python312Packages.setuptoolsCheckHook: remove
The hook relied on the `test` command passed to `setup.py`, which has
long been deprecated and finally removed in setuptools 72.0.
2024-08-06 18:18:40 +02:00
Robert T. McGibbon 2e55b7301b pytestCheckHook: improve disabledTestPaths whitespace handling 2021-05-14 21:59:55 -07:00
Martin Weinelt d6d63aef7d pytestCheckHook: add support for disabling arbitrary paths
Renames `disabledTestFiles` to the more genereric `disabledTestPaths` to
reflect that change.
2021-02-15 00:34:35 +01:00
Martin Weinelt 0f5743bee2 pytestCheckHook: Fix support for multiple files.
Quoting here will lead to the shell treating them as a single item.
2021-01-24 15:44:45 -08:00
Martin Weinelt 45e5ebfad8 pytestCheckHook: Fix support for spaces in disabled file paths 2021-01-24 15:44:45 -08:00
Sandro Jäckel 6f7f01a244 pytestCheckHook: Add disabledTestFiles option 2021-01-16 09:09:26 -08:00
Jonathan Ringer 884436b254 pythonPackages.pytestCheckHook: disable setuptoolsCheckPhase 2020-05-11 22:12:08 +02:00
John Ericson b7f4bda282 treewide: *Phase(s)? variables are optional
If these aren't defined, the stdenv defaults are used in the `*Phase`
case, or no extra phases are done, in the `*Phases` case.
2019-11-01 14:44:44 -04:00
John Ericson 2811b032d6 treewide: Make still dont* Variables are optional in most cases
Go beyond the obvious setup hooks now, with a bit of sed, with a skipped case:

 - cc-wrapper's `dontlink`, because it already is handled.

Also, in nix files escaping was manually added.

EMP
2019-11-01 14:44:44 -04:00
Frederik Rietdijk f7e28bf5d8 Split buildPythonPackage into setup hooks
This commit splits the `buildPythonPackage` into multiple setup hooks.

Generally, Python packages are built from source to wheels using `setuptools`.
The wheels are then installed with `pip`. Tests were often called with
`python setup.py test` but this is less common nowadays. Most projects
now use a different entry point for running tests, typically `pytest`
or `nosetests`.

Since the wheel format was introduced more tools were built to generate these,
e.g. `flit`. Since PEP 517 is provisionally accepted, defining a build-system
independent format (`pyproject.toml`), `pip` can now use that format to
execute the correct build-system.

In the past I've added support for PEP 517 (`pyproject`) to the Python
builder, resulting in a now rather large builder. Furthermore, it was not possible
to reuse components elsewhere. Therefore, the builder is now split into multiple
setup hooks.

The `setuptoolsCheckHook` is included now by default but in time it should
be removed from `buildPythonPackage` to make it easier to use another hook
(curently one has to pass in `dontUseSetuptoolsCheck`).
2019-09-06 15:18:45 +02:00