From 224d7b129cc600bd0e3c6325f016fa43533b781f Mon Sep 17 00:00:00 2001 From: Frederik Rietdijk Date: Sun, 7 Jun 2020 11:28:47 +0200 Subject: [PATCH] python.pkgs.pytest-mock: use 2.0.0 for python 2 --- .../python-modules/pytest-mock/2.nix | 40 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 5 ++- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/python-modules/pytest-mock/2.nix diff --git a/pkgs/development/python-modules/pytest-mock/2.nix b/pkgs/development/python-modules/pytest-mock/2.nix new file mode 100644 index 00000000000..3764a05af05 --- /dev/null +++ b/pkgs/development/python-modules/pytest-mock/2.nix @@ -0,0 +1,40 @@ +{ lib +, buildPythonPackage +, fetchPypi +, fetchpatch +, isPy3k +, pytest +, mock +, setuptools_scm +}: + +buildPythonPackage rec { + pname = "pytest-mock"; + version = "2.0.0"; + + src = fetchPypi { + inherit pname version; + sha256 = "b35eb281e93aafed138db25c8772b95d3756108b601947f89af503f8c629413f"; + }; + + propagatedBuildInputs = lib.optional (!isPy3k) mock; + + nativeBuildInputs = [ + setuptools_scm + ]; + + checkInputs = [ + pytest + ]; + + checkPhase = '' + pytest + ''; + + meta = with lib; { + description = "Thin-wrapper around the mock package for easier use with py.test."; + homepage = "https://github.com/pytest-dev/pytest-mock"; + license = licenses.mit; + maintainers = with maintainers; [ nand0p ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index d6b46fa9e76..3d795669d2c 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -2527,7 +2527,10 @@ in { pytest-mpl = callPackage ../development/python-modules/pytest-mpl { }; - pytest-mock = callPackage ../development/python-modules/pytest-mock { }; + pytest-mock = if isPy3k then + callPackage ../development/python-modules/pytest-mock { } + else + callPackage ../development/python-modules/pytest-mock/2.nix { }; pytest-openfiles = callPackage ../development/python-modules/pytest-openfiles { };