about summary refs log tree commit diff
path: root/pkgs/development/python-modules/pytest
diff options
context:
space:
mode:
authorFrederik Rietdijk <fridh@fridh.nl>2018-07-22 09:45:26 +0200
committerFrederik Rietdijk <fridh@fridh.nl>2018-07-22 09:45:26 +0200
commit610485faa7f8c043482c4a9c030938ed315557e5 (patch)
tree31e5955fe354ac75cee6583c27c6209fb4e65d78 /pkgs/development/python-modules/pytest
parentd5bb8889e4cb72e201648c3bfac929426291663e (diff)
downloadnixlib-610485faa7f8c043482c4a9c030938ed315557e5.tar
nixlib-610485faa7f8c043482c4a9c030938ed315557e5.tar.gz
nixlib-610485faa7f8c043482c4a9c030938ed315557e5.tar.bz2
nixlib-610485faa7f8c043482c4a9c030938ed315557e5.tar.lz
nixlib-610485faa7f8c043482c4a9c030938ed315557e5.tar.xz
nixlib-610485faa7f8c043482c4a9c030938ed315557e5.tar.zst
nixlib-610485faa7f8c043482c4a9c030938ed315557e5.zip
python.pkgs.pytest: setupHook to prevent creation of .pytest-cache folder, fixes #40273
When `py.test` was run with a folder as argument, it would not only
search for tests in that folder, but also create a .pytest-cache folder.
Not only is this state we don't want, but it was also causing
collisions.
Diffstat (limited to 'pkgs/development/python-modules/pytest')
-rw-r--r--pkgs/development/python-modules/pytest/default.nix7
1 files changed, 6 insertions, 1 deletions
diff --git a/pkgs/development/python-modules/pytest/default.nix b/pkgs/development/python-modules/pytest/default.nix
index b5a8cc252b97..1c0ceef83657 100644
--- a/pkgs/development/python-modules/pytest/default.nix
+++ b/pkgs/development/python-modules/pytest/default.nix
@@ -1,6 +1,6 @@
 { stdenv, buildPythonPackage, fetchPypi, attrs, hypothesis, py
 , setuptools_scm, setuptools, six, pluggy, funcsigs, isPy3k, more-itertools
-, atomicwrites, mock
+, atomicwrites, mock, writeText
 }:
 buildPythonPackage rec {
   version = "3.6.2";
@@ -27,6 +27,11 @@ buildPythonPackage rec {
     runHook postCheck
   '';
 
+  # Don't create .pytest-cache when using py.test in a Nix build
+  setupHook = writeText "pytest-hook" ''
+    export PYTEST_ADDOPTS="-p no:cacheprovider"
+  '';
+
   meta = with stdenv.lib; {
     maintainers = with maintainers; [ domenkozar lovek323 madjar lsix ];
     platforms = platforms.unix;