nixpkgs/pkgs/development/python-modules/pytest-xdist/default.nix
Artturin 50402f8839 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
2022-04-15 01:39:45 +02:00

59 lines
1.3 KiB
Nix

{ lib
, buildPythonPackage
, fetchPypi
, pythonOlder
, setuptools-scm
, pytestCheckHook
, filelock
, execnet
, pytest
, pytest-forked
, psutil
, pexpect
}:
buildPythonPackage rec {
pname = "pytest-xdist";
version = "2.5.0";
disabled = pythonOlder "3.6";
src = fetchPypi {
inherit pname version;
sha256 = "sha256-RYDeyj/wTdsqxT66Oddstd1e3qwFDLb7x2iw3XErTt8=";
};
nativeBuildInputs = [ setuptools-scm ];
buildInputs = [
pytest
];
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"
"test_rsync_popen_with_path"
"test_popen_rsync_subdir"
"test_rsync_report"
"test_init_rsync_roots"
"test_rsyncignore"
# flakey
"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";
license = licenses.mit;
maintainers = with maintainers; [ dotlambda ];
};
}