From dc5914413ccbf8eae2df17c845729f5287cb9fd5 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Sun, 25 Jan 2026 00:51:58 +0100 Subject: [PATCH] python3Packages.overrides: fix pytest9 compat --- .../python-modules/overrides/default.nix | 11 ++++------- .../overrides/pytest9-compat.patch | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+), 7 deletions(-) create mode 100644 pkgs/development/python-modules/overrides/pytest9-compat.patch diff --git a/pkgs/development/python-modules/overrides/default.nix b/pkgs/development/python-modules/overrides/default.nix index c938ee0d8506..6e039f28c807 100644 --- a/pkgs/development/python-modules/overrides/default.nix +++ b/pkgs/development/python-modules/overrides/default.nix @@ -2,7 +2,6 @@ lib, buildPythonPackage, fetchFromGitHub, - pythonAtLeast, pytestCheckHook, setuptools, }: @@ -19,15 +18,13 @@ buildPythonPackage rec { hash = "sha256-gQDw5/RpAFNYWFOuxIAArPkCOoBYWUnsDtv1FEFteHo="; }; - nativeBuildInputs = [ setuptools ]; + # https://github.com/mkorpela/overrides/pull/136 + patches = [ ./pytest9-compat.patch ]; + + build-system = [ setuptools ]; nativeCheckInputs = [ pytestCheckHook ]; - disabledTests = lib.optionals (pythonAtLeast "3.12") [ - # KeyError: 'assertRaises' - "test_enforcing_when_incompatible" - ]; - pythonImportsCheck = [ "overrides" ]; meta = { diff --git a/pkgs/development/python-modules/overrides/pytest9-compat.patch b/pkgs/development/python-modules/overrides/pytest9-compat.patch new file mode 100644 index 000000000000..e810f60c76f5 --- /dev/null +++ b/pkgs/development/python-modules/overrides/pytest9-compat.patch @@ -0,0 +1,19 @@ +diff --git a/conftest.py b/conftest.py +index a00ac4e..51f37fe 100644 +--- a/conftest.py ++++ b/conftest.py +@@ -1,11 +1,10 @@ + import sys ++from pathlib import Path + from typing import Optional + +-import py + +- +-def pytest_ignore_collect(path: py.path.local, config: "Config") -> Optional[bool]: ++def pytest_ignore_collect(collection_path: Path) -> Optional[bool]: + if sys.version_info[0] == 3 and sys.version_info[1] < 8: +- if str(path).endswith("__py38.py"): ++ if str(collection_path.name).endswith("__py38.py"): + return True + return None