diff --git a/pkgs/development/python-modules/pytest/8.2.2-unittest-testcase-regression.patch b/pkgs/development/python-modules/pytest/8.2.2-unittest-testcase-regression.patch deleted file mode 100644 index 1d127b191f81..000000000000 --- a/pkgs/development/python-modules/pytest/8.2.2-unittest-testcase-regression.patch +++ /dev/null @@ -1,72 +0,0 @@ -From de47b73520fd9b7e41272701d7fd4663357af046 Mon Sep 17 00:00:00 2001 -From: Ran Benita -Date: Fri, 7 Jun 2024 09:49:29 +0300 -Subject: [PATCH] unittest: fix assertion errors on unittest reruns - -This fixes unittest test reruns when using plugins like -pytest-rerunfailures. - -The `instance` property uses AttributeError to check if the instance -needs to be initialized, so `del` is the correct way to clear it, not -setting to `None`. - -Regressed in 8.2.2. ---- - changelog/12424.bugfix.rst | 1 + - src/_pytest/unittest.py | 2 +- - .../pytest_rerunfailures_integration.py | 11 +++++++++++ - tox.ini | 2 +- - 4 files changed, 14 insertions(+), 2 deletions(-) - create mode 100644 changelog/12424.bugfix.rst - create mode 100644 testing/plugins_integration/pytest_rerunfailures_integration.py - -diff --git a/changelog/12424.bugfix.rst b/changelog/12424.bugfix.rst -new file mode 100644 -index 00000000000..7ad1126858b ---- /dev/null -+++ b/changelog/12424.bugfix.rst -@@ -0,0 +1 @@ -+Fix crash with `assert testcase is not None` assertion failure when re-running unittest tests using plugins like pytest-rerunfailures. Regressed in 8.2.2. -diff --git a/src/_pytest/unittest.py b/src/_pytest/unittest.py -index 643443f08c6..ca82ac5c14a 100644 ---- a/src/_pytest/unittest.py -+++ b/src/_pytest/unittest.py -@@ -222,7 +222,7 @@ def teardown(self) -> None: - self._explicit_tearDown() - self._explicit_tearDown = None - self._obj = None -- self._instance = None -+ del self._instance - super().teardown() - - def startTest(self, testcase: "unittest.TestCase") -> None: -diff --git a/testing/plugins_integration/pytest_rerunfailures_integration.py b/testing/plugins_integration/pytest_rerunfailures_integration.py -new file mode 100644 -index 00000000000..9a13a3279a9 ---- /dev/null -+++ b/testing/plugins_integration/pytest_rerunfailures_integration.py -@@ -0,0 +1,11 @@ -+import unittest -+ -+ -+class MyTestCase(unittest.TestCase): -+ first_time = True -+ -+ def test_fail_the_first_time(self) -> None: -+ """Regression test for issue #12424.""" -+ if self.first_time: -+ type(self).first_time = False -+ self.fail() -diff --git a/tox.ini b/tox.ini -index 0a3f0acf5b8..35b335a015d 100644 ---- a/tox.ini -+++ b/tox.ini -@@ -141,7 +141,7 @@ commands = - pytest --cov=. simple_integration.py - pytest --ds=django_settings simple_integration.py - pytest --html=simple.html simple_integration.py -- pytest --reruns 5 simple_integration.py -+ pytest --reruns 5 simple_integration.py pytest_rerunfailures_integration.py - pytest pytest_anyio_integration.py - pytest pytest_asyncio_integration.py - pytest pytest_mock_integration.py diff --git a/pkgs/development/python-modules/pytest/default.nix b/pkgs/development/python-modules/pytest/default.nix index 38675d502277..fc5ca9c2a37b 100644 --- a/pkgs/development/python-modules/pytest/default.nix +++ b/pkgs/development/python-modules/pytest/default.nix @@ -29,20 +29,14 @@ buildPythonPackage rec { pname = "pytest"; - version = "8.2.2"; + version = "8.3.2"; pyproject = true; src = fetchPypi { inherit pname version; - hash = "sha256-3ku4EE4gGTnM3GiLJ6iae+IHmyLivSsH+Aa2unEReXc="; + hash = "sha256-wTI0XRLOVRJCyHJp3oEkg/W8yHzbtHIuSEh7oZT5/c4="; }; - patches = [ - # https://github.com/pytest-dev/pytest/issues/12424 - # https://github.com/pytest-dev/pytest/pull/12436 - ./8.2.2-unittest-testcase-regression.patch - ]; - outputs = [ "out" "testout"