Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion pkgs/development/python-modules/pytest-xdist/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
, pytest
, pytest-forked
, psutil
, pexpect
}:

buildPythonPackage rec {
Expand All @@ -25,9 +26,15 @@ buildPythonPackage rec {
buildInputs = [
pytest
];
checkInputs = [ pytestCheckHook filelock ];
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"
Expand All @@ -40,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";
Expand Down
7 changes: 7 additions & 0 deletions pkgs/development/python-modules/pytest-xdist/setup-hook.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pytestXdistHook() {
pytestFlagsArray+=("--numprocesses=$NIX_BUILD_CORES" "--forked" )
}

if [ -z "${dontUsePytestXdist-}" ] && [ -z "${dontUsePytestCheck-}" ]; then
addEnvHooks "$hostOffset" pytestXdistHook
fi