1{ lib
2, buildPythonPackage
3, fetchPypi
4, isPy27
5, funcsigs
6, six
7, pbr
8, python
9, pytest
10}:
11
12buildPythonPackage rec {
13 pname = "mock";
14 version = "4.0.3";
15
16 src = fetchPypi {
17 inherit pname version;
18 sha256 = "7d3fbbde18228f4ff2f1f119a45cdffa458b4c0dee32eb4d2bb2f82554bac7bc";
19 };
20
21 propagatedBuildInputs = [ six pbr ] ++ lib.optionals isPy27 [ funcsigs ];
22
23 # On PyPy for Python 2.7 in particular, Mock's tests have a known failure.
24 # Mock upstream has a decoration to disable the failing test and make
25 # everything pass, but it is not yet released. The commit:
26 # https://github.com/testing-cabal/mock/commit/73bfd51b7185#diff-354f30a63fb0907d4ad57269548329e3L12
27 #doCheck = !(python.isPyPy && python.isPy27);
28 doCheck = false; # Infinite recursion pytest
29
30 checkPhase = ''
31 ${python.interpreter} -m unittest discover
32 '';
33
34 checkInputs = [
35 pytest
36 ];
37
38 meta = with lib; {
39 description = "Mock objects for Python";
40 homepage = "http://python-mock.sourceforge.net/";
41 license = licenses.bsd2;
42 };
43
44}