mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-28 18:03:04 +00:00
python39Packages.pytest-xdist: add hook to add flags
many of our packages have pytest-xdist in their inputs however oftentimes the required flags aren't added to pytest flags since we dont use tox and other frameworks some examples of improvements (my pc has ryzen 9 5900x) hypothesis 11m:15s on hydra -> <1m on my pc hypothesmith 8m on my pc -> <1m on my pc the whole graph from pytest-xdist (tested by adding postPatch with true to xdist) time nix build ".#python3Packages.hypothesmith" 19m:57s -> 9m:13s
This commit is contained in:
parent
3b3bf22264
commit
50402f8839
@ -29,6 +29,12 @@ buildPythonPackage rec {
|
||||
checkInputs = [ pytestCheckHook filelock pexpect ];
|
||||
propagatedBuildInputs = [ execnet pytest-forked psutil ];
|
||||
|
||||
pytestFlagsArray = [
|
||||
# pytest can already use xdist at this point
|
||||
"--numprocesses=$NIX_BUILD_CORES"
|
||||
"--forked"
|
||||
];
|
||||
|
||||
# access file system
|
||||
disabledTests = [
|
||||
"test_distribution_rsyncdirs_example"
|
||||
@ -41,6 +47,8 @@ buildPythonPackage rec {
|
||||
"test_internal_errors_propagate_to_controller"
|
||||
];
|
||||
|
||||
setupHook = ./setup-hook.sh;
|
||||
|
||||
meta = with lib; {
|
||||
description = "Pytest xdist plugin for distributed testing and loop-on-failing modes";
|
||||
homepage = "https://github.com/pytest-dev/pytest-xdist";
|
||||
|
@ -0,0 +1,7 @@
|
||||
pytestXdistHook() {
|
||||
pytestFlagsArray+=("--numprocesses=$NIX_BUILD_CORES" "--forked" )
|
||||
}
|
||||
|
||||
if [ -z "${dontUsePytestXdist-}" ] && [ -z "${dontUsePytestCheck-}" ]; then
|
||||
addEnvHooks "$hostOffset" pytestXdistHook
|
||||
fi
|
Loading…
Reference in New Issue
Block a user