1{ stdenv, buildPythonPackage, pythonOlder, fetchPypi, attrs, hypothesis, py
2, setuptools_scm, setuptools, six, pluggy, funcsigs, isPy3k, more-itertools
3, atomicwrites, mock, writeText, pathlib2, wcwidth, packaging, isPyPy, python
4}:
5buildPythonPackage rec {
6 version = "5.3.5";
7 pname = "pytest";
8
9 disabled = !isPy3k;
10
11 preCheck = ''
12 # don't test bash builtins
13 rm testing/test_argcomplete.py
14 '';
15
16 src = fetchPypi {
17 inherit pname version;
18 sha256 = "0d5fe9189a148acc3c3eb2ac8e1ac0742cb7618c084f3d228baaec0c254b318d";
19 };
20
21 checkInputs = [ hypothesis mock ];
22 nativeBuildInputs = [ setuptools_scm ];
23 propagatedBuildInputs = [ attrs py setuptools six pluggy more-itertools atomicwrites wcwidth packaging ]
24 ++ stdenv.lib.optionals (pythonOlder "3.6") [ pathlib2 ];
25
26 doCheck = !isPyPy; # https://github.com/pytest-dev/pytest/issues/3460
27
28 # Ignored file https://github.com/pytest-dev/pytest/pull/5605#issuecomment-522243929
29 checkPhase = ''
30 runHook preCheck
31 $out/bin/py.test -x testing/ -k "not test_collect_pyargs_with_testpaths" --ignore=testing/test_junitxml.py
32 runHook postCheck
33 '';
34
35 # Remove .pytest_cache when using py.test in a Nix build
36 setupHook = writeText "pytest-hook" ''
37 pytestcachePhase() {
38 find $out -name .pytest_cache -type d -exec rm -rf {} +
39 }
40 preDistPhases+=" pytestcachePhase"
41 '';
42
43 pythonImportsCheck = [
44 "pytest"
45 ];
46
47 meta = with stdenv.lib; {
48 homepage = https://docs.pytest.org;
49 description = "Framework for writing tests";
50 maintainers = with maintainers; [ domenkozar lovek323 madjar lsix ];
51 license = licenses.mit;
52 };
53}