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.
This commit is contained in:
Frederik Rietdijk 2018-07-22 09:45:26 +02:00
parent d5bb8889e4
commit 610485faa7

View File

@ -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;