python.pkgs.pytest_3: keep older version

because not all test suites are compatible with 4 yet.
This commit is contained in:
Frederik Rietdijk 2019-02-14 11:07:19 +01:00
parent b4acd97729
commit b3febfb850
5 changed files with 63 additions and 7 deletions

View file

@ -1,5 +1,5 @@
{ stdenv, buildPythonPackage, fetchPypi
, pytest, setuptools_scm }:
, pytest_3, setuptools_scm }:
buildPythonPackage rec {
pname = "apipkg";
@ -10,8 +10,8 @@ buildPythonPackage rec {
sha256 = "37228cda29411948b422fae072f57e31d3396d2ee1c9783775980ee9c9990af6";
};
buildInputs = [ setuptools_scm ];
checkInputs = [ pytest ];
nativeBuildInputs = [ setuptools_scm ];
checkInputs = [ pytest_3 ];
checkPhase = ''
py.test

View file

@ -1,5 +1,5 @@
{ stdenv, buildPythonPackage, fetchPypi
, pytest, pytestrunner, hypothesis }:
, pytest_3, pytestrunner, hypothesis }:
buildPythonPackage rec {
pname = "chardet";
@ -10,7 +10,7 @@ buildPythonPackage rec {
sha256 = "1bpalpia6r5x1kknbk11p1fzph56fmmnp405ds8icksd3knr5aw4";
};
checkInputs = [ pytest pytestrunner hypothesis ];
checkInputs = [ pytest_3 pytestrunner hypothesis ];
meta = with stdenv.lib; {
homepage = https://github.com/chardet/chardet;

View file

@ -1,7 +1,7 @@
{ stdenv
, buildPythonPackage
, fetchPypi
, pytest
, pytest_3
, setuptools_scm
, apipkg
}:
@ -15,7 +15,7 @@ buildPythonPackage rec {
sha256 = "a7a84d5fa07a089186a329528f127c9d73b9de57f1a1131b82bb5320ee651f6a";
};
checkInputs = [ pytest ];
checkInputs = [ pytest_3 ];
nativeBuildInputs = [ setuptools_scm ];
propagatedBuildInputs = [ apipkg ];
@ -31,6 +31,9 @@ buildPythonPackage rec {
py.test testing
'';
# not yet compatible with pytest 4
doCheck = false;
__darwinAllowLocalNetworking = true;
meta = with stdenv.lib; {

View file

@ -0,0 +1,47 @@
{ stdenv, buildPythonPackage, pythonOlder, fetchPypi, attrs, hypothesis, py
, setuptools_scm, setuptools, six, pluggy, funcsigs, isPy3k, more-itertools
, atomicwrites, mock, writeText, pathlib2
}:
buildPythonPackage rec {
version = "3.10.1";
pname = "pytest";
preCheck = ''
# don't test bash builtins
rm testing/test_argcomplete.py
'';
src = fetchPypi {
inherit pname version;
sha256 = "e246cf173c01169b9617fc07264b7b1316e78d7a650055235d6d897bc80d9660";
};
checkInputs = [ hypothesis mock ];
buildInputs = [ setuptools_scm ];
propagatedBuildInputs = [ attrs py setuptools six pluggy more-itertools atomicwrites]
++ stdenv.lib.optionals (!isPy3k) [ funcsigs ]
++ stdenv.lib.optionals (pythonOlder "3.6") [ pathlib2 ];
checkPhase = ''
runHook preCheck
$out/bin/py.test -x testing/ -k "not test_raises_exception_looks_iterable"
runHook postCheck
'';
# Remove .pytest_cache when using py.test in a Nix build
setupHook = writeText "pytest-hook" ''
pytestcachePhase() {
find $out -name .pytest_cache -type d -exec rm -rf {} +
}
preDistPhases+=" pytestcachePhase"
'';
meta = with stdenv.lib; {
homepage = https://docs.pytest.org;
description = "Framework for writing tests";
maintainers = with maintainers; [ domenkozar lovek323 madjar lsix ];
license = licenses.mit;
platforms = platforms.unix;
};
}

View file

@ -1500,6 +1500,12 @@ in {
hypothesis = self.hypothesis.override { doCheck = false; };
};
# Keep 3 because many test suites are not yet compatible with Pytest 4.
pytest_3 = callPackage ../development/python-modules/pytest/3.10.nix {
# hypothesis tests require pytest that causes dependency cycle
hypothesis = self.hypothesis.override { doCheck = false; };
};
pytest-httpbin = callPackage ../development/python-modules/pytest-httpbin { };
pytest-asyncio = callPackage ../development/python-modules/pytest-asyncio { };