1{ stdenv, buildPythonPackage, fetchPypi, attrs, hypothesis, py
2, setuptools_scm, setuptools, six, pluggy, funcsigs, isPy3k, more-itertools
3, atomicwrites, mock, writeText, pathlib2
4}:
5buildPythonPackage rec {
6 version = "3.7.4";
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 = "2d7c49e931316cc7d1638a3e5f54f5d7b4e5225972b3c9838f3584788d27f349";
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 pathlib2 ];
23
24 checkPhase = ''
25 runHook preCheck
26 $out/bin/py.test -x testing/
27 runHook postCheck
28 '';
29
30 # Remove .pytest_cache when using py.test in a Nix build
31 setupHook = writeText "pytest-hook" ''
32 postFixupHooks+=(
33 'find $out -name .pytest_cache -type d -exec rm -rf {} +'
34 )
35 '';
36
37 meta = with stdenv.lib; {
38 maintainers = with maintainers; [ domenkozar lovek323 madjar lsix ];
39 platforms = platforms.unix;
40 description = "Framework for writing tests";
41 };
42}