From c057afbc4d8ea908adc18855c9ecb890a7802c51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Sun, 21 Jun 2026 21:20:46 +0200 Subject: [PATCH 1/2] python3Packages.pytest-memray: init at 1.8.0 --- .../python-modules/pytest-memray/default.nix | 56 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 58 insertions(+) create mode 100644 pkgs/development/python-modules/pytest-memray/default.nix diff --git a/pkgs/development/python-modules/pytest-memray/default.nix b/pkgs/development/python-modules/pytest-memray/default.nix new file mode 100644 index 000000000000..f24ffe21881a --- /dev/null +++ b/pkgs/development/python-modules/pytest-memray/default.nix @@ -0,0 +1,56 @@ +{ + lib, + anyio, + buildPythonPackage, + fetchFromGitHub, + flaky, + hatchling, + hatch-vcs, + memray, + pytest, + pytest-xdist, + pytestCheckHook, +}: + +buildPythonPackage (finalAttrs: { + pname = "pytest-memray"; + version = "1.8.0"; + pyproject = true; + + src = fetchFromGitHub { + owner = "bloomberg"; + repo = "pytest-memray"; + tag = "v${finalAttrs.version}"; + hash = "sha256-73Lyy14t2Hcqo0aTlWbGMzaxJ73bKjzc4BFE/jPG99I="; + }; + + build-system = [ + hatchling + hatch-vcs + ]; + + dependencies = [ memray ]; + + buildInputs = [ pytest ]; + + nativeCheckInputs = [ + anyio + flaky + pytest-xdist + pytestCheckHook + ]; + + enabledTestPaths = [ + # don't run the demo tests + "tests" + ]; + + pythonImportsCheck = [ "pytest_memray" ]; + + meta = { + description = "Pytest plugin for easy integration of memray memory profiler"; + homepage = "https://github.com/bloomberg/pytest-memray"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ SuperSandro2000 ]; + }; +}) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 4666c70de2f0..7903e561e516 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -15846,6 +15846,8 @@ self: super: with self; { pytest-md-report = callPackage ../development/python-modules/pytest-md-report { }; + pytest-memray = callPackage ../development/python-modules/pytest-memray { }; + pytest-metadata = callPackage ../development/python-modules/pytest-metadata { }; pytest-mock = callPackage ../development/python-modules/pytest-mock { }; From 4ddd9cf2489a4b8a68f38318b671605fa6a71bd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Sun, 21 Jun 2026 21:20:57 +0200 Subject: [PATCH 2/2] python314Packages.pyturbojpeg: enable tests --- .../python-modules/pyturbojpeg/default.nix | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/pkgs/development/python-modules/pyturbojpeg/default.nix b/pkgs/development/python-modules/pyturbojpeg/default.nix index f6aa0ba577f3..d45067c67647 100644 --- a/pkgs/development/python-modules/pyturbojpeg/default.nix +++ b/pkgs/development/python-modules/pyturbojpeg/default.nix @@ -6,7 +6,8 @@ libjpeg_turbo, setuptools, numpy, - python, + pytest-memray, + pytestCheckHook, replaceVars, }: @@ -32,14 +33,15 @@ buildPythonPackage rec { dependencies = [ numpy ]; - # upstream has no tests, but we want to test whether the library is found - checkPhase = '' - runHook preCheck + nativeCheckInputs = [ + pytest-memray + pytestCheckHook + ]; - ${python.interpreter} -c 'from turbojpeg import TurboJPEG; TurboJPEG()' - - runHook postCheck - ''; + disabledTests = [ + # our patch breaks the test + "test_library_loading_error_message" + ]; pythonImportsCheck = [ "turbojpeg" ];