diff --git a/pkgs/development/python-modules/pytest/default.nix b/pkgs/development/python-modules/pytest/default.nix index 93282218871..e0648285810 100644 --- a/pkgs/development/python-modules/pytest/default.nix +++ b/pkgs/development/python-modules/pytest/default.nix @@ -58,6 +58,12 @@ buildPythonPackage rec { checkPhase = '' runHook preCheck $out/bin/py.test -x testing/ -k "not test_collect_pyargs_with_testpaths" --ignore=testing/test_junitxml.py + + # tests leave behind unreproducible pytest binaries in the output directory, remove: + find $out/lib -name "*-pytest-${version}.pyc" -delete + # specifically testing/test_assertion.py and testing/test_assertrewrite.py leave behind those: + find $out/lib -name "*opt-2.pyc" -delete + runHook postCheck '';