1{ stdenv, buildPythonPackage, pythonOlder, fetchPypi, attrs, hypothesis, py
2, setuptools_scm, setuptools, six, pluggy, funcsigs, isPy3k, more-itertools
3, atomicwrites, mock, writeText, pathlib2
4}:
5buildPythonPackage rec {
6 version = "4.2.1";
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 = "c2396a15726218a2dfef480861c4ba37bd3952ebaaa5b0fede3fc23fddcd7f8c";
17 };
18
19 checkInputs = [ hypothesis mock ];
20 buildInputs = [ setuptools_scm ];
21 propagatedBuildInputs = [ attrs py setuptools six pluggy more-itertools atomicwrites]
22 ++ stdenv.lib.optionals (!isPy3k) [ funcsigs ]
23 ++ stdenv.lib.optionals (pythonOlder "3.6") [ pathlib2 ];
24
25 checkPhase = ''
26 runHook preCheck
27 $out/bin/py.test -x testing/ -k "not test_collect_pyargs_with_testpaths"
28 runHook postCheck
29 '';
30
31 # Remove .pytest_cache when using py.test in a Nix build
32 setupHook = writeText "pytest-hook" ''
33 pytestcachePhase() {
34 find $out -name .pytest_cache -type d -exec rm -rf {} +
35 }
36
37 preDistPhases+=" pytestcachePhase"
38 '';
39
40 meta = with stdenv.lib; {
41 homepage = https://docs.pytest.org;
42 description = "Framework for writing tests";
43 maintainers = with maintainers; [ domenkozar lovek323 madjar lsix ];
44 license = licenses.mit;
45 platforms = platforms.unix;
46 };
47}