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