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