From a2c93555e7c8e979042385c338d5e5f7eaa2d482 Mon Sep 17 00:00:00 2001 From: Frederik Rietdijk Date: Sat, 9 May 2020 13:15:43 +0200 Subject: [PATCH] pythonPackages.mock: have 3.0.5 for python 2, disable tests python 3 because of circular dependency. --- pkgs/development/python-modules/mock/2.nix | 44 +++++++++++++++++++ .../python-modules/mock/default.nix | 8 +++- pkgs/top-level/python-packages.nix | 5 ++- 3 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 pkgs/development/python-modules/mock/2.nix diff --git a/pkgs/development/python-modules/mock/2.nix b/pkgs/development/python-modules/mock/2.nix new file mode 100644 index 00000000000..9ab8de1ba50 --- /dev/null +++ b/pkgs/development/python-modules/mock/2.nix @@ -0,0 +1,44 @@ +{ lib +, buildPythonPackage +, fetchPypi +, isPy27 +, funcsigs +, six +, pbr +, python +, pytest +}: + +buildPythonPackage rec { + pname = "mock"; + version = "3.0.5"; + + src = fetchPypi { + inherit pname version; + sha256 = "83657d894c90d5681d62155c82bda9c1187827525880eda8ff5df4ec813437c3"; + }; + + propagatedBuildInputs = [ six pbr ] ++ lib.optionals isPy27 [ funcsigs ]; + + # On PyPy for Python 2.7 in particular, Mock's tests have a known failure. + # Mock upstream has a decoration to disable the failing test and make + # everything pass, but it is not yet released. The commit: + # https://github.com/testing-cabal/mock/commit/73bfd51b7185#diff-354f30a63fb0907d4ad57269548329e3L12 + #doCheck = !(python.isPyPy && python.isPy27); + doCheck = false; # Infinite recursion pytest + + checkPhase = '' + ${python.interpreter} -m unittest discover + ''; + + checkInputs = [ + pytest + ]; + + meta = with lib; { + description = "Mock objects for Python"; + homepage = "http://python-mock.sourceforge.net/"; + license = licenses.bsd2; + }; + +} \ No newline at end of file diff --git a/pkgs/development/python-modules/mock/default.nix b/pkgs/development/python-modules/mock/default.nix index 84c25658b06..e905add00f5 100644 --- a/pkgs/development/python-modules/mock/default.nix +++ b/pkgs/development/python-modules/mock/default.nix @@ -6,6 +6,7 @@ , six , pbr , python +, pytest }: buildPythonPackage rec { @@ -23,12 +24,17 @@ buildPythonPackage rec { # Mock upstream has a decoration to disable the failing test and make # everything pass, but it is not yet released. The commit: # https://github.com/testing-cabal/mock/commit/73bfd51b7185#diff-354f30a63fb0907d4ad57269548329e3L12 - doCheck = !(python.isPyPy && python.isPy27); + #doCheck = !(python.isPyPy && python.isPy27); + doCheck = false; # Infinite recursion pytest checkPhase = '' ${python.interpreter} -m unittest discover ''; + checkInputs = [ + pytest + ]; + meta = with lib; { description = "Mock objects for Python"; homepage = "http://python-mock.sourceforge.net/"; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index acf1dd558e9..8b6c9c9a1c7 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -4505,7 +4505,10 @@ in { editorconfig = callPackage ../development/python-modules/editorconfig { }; - mock = callPackage ../development/python-modules/mock { }; + mock = if pythonOlder "3.6" then + callPackage ../development/python-modules/mock/2.nix { } + else + callPackage ../development/python-modules/mock { }; mock-open = callPackage ../development/python-modules/mock-open { };