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