diff options
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/pytest/5.nix')
-rw-r--r-- | nixpkgs/pkgs/development/python-modules/pytest/5.nix | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/pytest/5.nix b/nixpkgs/pkgs/development/python-modules/pytest/5.nix index b38c1a759fe3..ee04e3be429f 100644 --- a/nixpkgs/pkgs/development/python-modules/pytest/5.nix +++ b/nixpkgs/pkgs/development/python-modules/pytest/5.nix @@ -1,16 +1,13 @@ { lib, buildPythonPackage, pythonOlder, fetchPypi, isPy3k, isPyPy , atomicwrites , attrs -, funcsigs , hypothesis -, mock , more-itertools , packaging , pathlib2 , pluggy , py , pygments -, python , setuptools , setuptools-scm , six @@ -70,6 +67,19 @@ buildPythonPackage rec { find $out -name .pytest_cache -type d -exec rm -rf {} + } preDistPhases+=" pytestcachePhase" + + # pytest generates it's own bytecode files to improve assertion messages. + # These files similar to cpython's bytecode files but are never laoded + # by python interpreter directly. We remove them for a few reasons: + # - files are non-deterministic: https://github.com/NixOS/nixpkgs/issues/139292 + # (file headers are generatedt by pytest directly and contain timestamps) + # - files are not needed after tests are finished + pytestRemoveBytecodePhase () { + # suffix is defined at: + # https://github.com/pytest-dev/pytest/blob/5.4.3/src/_pytest/assertion/rewrite.py#L42-L45 + find $out -name "*-pytest-*.py[co]" -delete + } + preDistPhases+=" pytestRemoveBytecodePhase" ''; pythonImportsCheck = [ |