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