From f07f108c7c0ff8969a2d708cc199183f9a198516 Mon Sep 17 00:00:00 2001 From: Ryan Hendrickson Date: Sat, 20 May 2023 14:40:24 -0400 Subject: [PATCH] python311Packages.pympler: fix tests --- .../python-modules/pympler/default.nix | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/pkgs/development/python-modules/pympler/default.nix b/pkgs/development/python-modules/pympler/default.nix index 3763aeabbcf..9b801e42c8a 100644 --- a/pkgs/development/python-modules/pympler/default.nix +++ b/pkgs/development/python-modules/pympler/default.nix @@ -1,7 +1,10 @@ { lib, stdenv +, bottle , buildPythonPackage +, fetchpatch , fetchPypi , pytestCheckHook +, pythonAtLeast }: buildPythonPackage rec { @@ -13,14 +16,36 @@ buildPythonPackage rec { sha256 = "993f1a3599ca3f4fcd7160c7545ad06310c9e12f70174ae7ae8d4e25f6c5d3fa"; }; + patches = [ + # Fixes a TypeError on Python 3.11 + # (see https://github.com/pympler/pympler/issues/148) + (fetchpatch { + name = "${pname}-python-3.11-compat.patch"; + url = "https://github.com/pympler/pympler/pull/149.patch"; + hash = "sha256-6MK0AuhVhQkUzlk29HUh1+mSbfsVTBJ1YBtYNIFhh7U="; + }) + ]; + nativeCheckInputs = [ pytestCheckHook ]; + # There is a version of bottle bundled with Pympler, but it is broken on + # Python 3.11. Fortunately, Pympler will preferentially import an external + # bottle if it is available, so we make it an explicit dependency. + propagatedBuildInputs = [ + bottle + ]; + disabledTests = [ # 'AssertionError: 'function (test.muppy.test_summary.func)' != 'function (muppy.test_summary.func)' # https://github.com/pympler/pympler/issues/134 "test_repr_function" + ] ++ lib.optionals (pythonAtLeast "3.11") [ + # https://github.com/pympler/pympler/issues/148 + "test_findgarbage" + "test_get_tree" + "test_prune" ]; doCheck = stdenv.hostPlatform.isLinux;