-
-
Notifications
You must be signed in to change notification settings - Fork 18k
python39Packages.pytest-xdist: add hook to add flags #166486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Not relevant right now, but in case |
SuperSandro2000
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will be very valuable. Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this duplicate what happens in the setup hook?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't think the setup hook is used at this point yet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just tested and yep its not used at this point
if i apply the following the build fails with
python3.9-pytest-xdist> substitute(): ERROR: file '/nix/store/q4qj7q82vrxfwnmymyhdwxid0sr0rjnn-hook' does not exist
diff --git a/pkgs/development/python-modules/pytest-xdist/default.nix b/pkgs/development/python-modules/pytest-xdist/default.nix
index 75fd066c76d..ae23bf3f31b 100644
--- a/pkgs/development/python-modules/pytest-xdist/default.nix
+++ b/pkgs/development/python-modules/pytest-xdist/default.nix
@@ -1,4 +1,5 @@
{ lib
+, makeSetupHook
, buildPythonPackage
, fetchPypi
, pythonOlder
@@ -12,6 +13,10 @@
, pexpect
}:
+let
+ setupHook' = makeSetupHook {} ./setup-hook.sh;
+in
+
buildPythonPackage rec {
pname = "pytest-xdist";
version = "2.5.0";
@@ -26,11 +31,9 @@ buildPythonPackage rec {
buildInputs = [
pytest
];
- checkInputs = [ pytestCheckHook filelock pexpect ];
+ checkInputs = [ pytestCheckHook filelock pexpect setupHook' ];
propagatedBuildInputs = [ execnet pytest-forked psutil ];
- pytestFlagsArray = [ "-n $NIX_BUILD_CORES" "--forked" ]; # pytest can already use xdist at this point
-
# access file system
disabledTests = [
"test_distribution_rsyncdirs_example"
@@ -43,7 +46,7 @@ buildPythonPackage rec {
"test_internal_errors_propagate_to_controller"
];
- setupHook = ./setup-hook.sh;
+ setupHook = setupHook';
meta = with lib; {
description = "Pytest xdist plugin for distributed testing and loop-on-failing modes";|
I think this is a reasonable change and we can test it in #166489 if you rebase onto that. |
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
|
I don't usually package python, so I'll unsubscribe after my superficial observation earlier. |
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
Things done
sandbox = trueset innix.conf? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)nixos/doc/manual/md-to-db.shto update generated release notes