1{ lib
2, buildPythonPackage
3, fetchPypi
4, fetchpatch
5, isPy3k
6, pytest
7, mock
8, setuptools_scm
9}:
10
11buildPythonPackage rec {
12 pname = "pytest-mock";
13 version = "1.10.4";
14
15 src = fetchPypi {
16 inherit pname version;
17 sha256 = "5bf5771b1db93beac965a7347dc81c675ec4090cb841e49d9d34637a25c30568";
18 };
19
20 propagatedBuildInputs = lib.optional (!isPy3k) mock;
21
22 nativeBuildInputs = [
23 setuptools_scm
24 ];
25
26 checkInputs = [
27 pytest
28 ];
29
30 patches = [
31 # Fix tests for pytest 4.6. Remove with the next release
32 (fetchpatch {
33 url = "https://github.com/pytest-dev/pytest-mock/commit/189cc599d3bfbe91a17c93211c04237b6c5849b1.patch";
34 sha256 = "13nk75ldab3j8nfzyd9w4cgfk2fxq4if1aqkqy82ar7y7qh07a7m";
35 })
36 ];
37
38 checkPhase = ''
39 # remove disabled test on next release
40 # https://github.com/pytest-dev/pytest-mock/pull/151
41 pytest -k "not test_detailed_introspection"
42 '';
43
44 meta = with lib; {
45 description = "Thin-wrapper around the mock package for easier use with py.test.";
46 homepage = https://github.com/pytest-dev/pytest-mock;
47 license = licenses.mit;
48 maintainers = with maintainers; [ nand0p ];
49 };
50}