diff --git a/pytest82.patch b/pytest82.patch deleted file mode 100644 index 9135649..0000000 --- a/pytest82.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 91e617a5c0bb220779b1d9912f3e946a28be53d4 Mon Sep 17 00:00:00 2001 -From: Natanael Copa -Date: Mon, 13 May 2024 08:43:49 +0200 -Subject: [PATCH] Treat methodName="runTest" similar to unittest.TestCase - -pytest 8.2 relies on a feature of `unittest.TestCase` where the -initialization of it with the default `methodName="runTest"` is treated -specially, allowing it to insantiate even without `runTest` method -actually existing. - -See under "Changed in Python 3.2" in unittest.TestCase docs - -This fixes the error with pytest 8.2: - AttributeError: 'TestUtil' object has no attribute 'runTest'. Did you mean: 'subTest'? - -Fixes: https://github.com/testing-cabal/testtools/issues/372 -ref: https://docs.python.org/3/library/unittest.html#unittest.TestCase -ref: https://github.com/python/cpython/blob/51aefc5bf907ddffaaf083ded0de773adcdf08c8/Lib/unittest/case.py#L419-L426 -ref: https://github.com/pytest-dev/pytest/issues/12263#issuecomment-2081434468 ---- - testtools/testcase.py | 12 +++++++++++- - 1 file changed, 11 insertions(+), 1 deletion(-) - -diff --git a/testtools/testcase.py b/testtools/testcase.py -index 08b158b6..b8722df7 100644 ---- a/testtools/testcase.py -+++ b/testtools/testcase.py -@@ -735,7 +735,17 @@ def _run_teardown(self, result): - - def _get_test_method(self): - method_name = getattr(self, '_testMethodName') -- return getattr(self, method_name) -+ try: -+ m = getattr(self, method_name) -+ except AttributeError: -+ if method_name != "runTest": -+ # We allow instantiation with no explicit method name -+ # but not an *incorrect* or missing method name. -+ raise ValueError( -+ "no such test method in %s: %s" % (self.__class__, method_name) -+ ) -+ else: -+ return m - - def _run_test_method(self, result): - """Run the test method for this test. diff --git a/python-testtools.changes b/python-testtools.changes index 4800131..4e39342 100644 --- a/python-testtools.changes +++ b/python-testtools.changes @@ -1,3 +1,16 @@ +------------------------------------------------------------------- +Mon Sep 23 14:06:48 UTC 2024 - Markéta Machová + +- Update to 2.7.2 + * Treat methodName="runTest" similar to unittest.TestCase, + fixes compatibility with pytest 8.3. (Natanael Copa, #372) + * Use ruff for linting. (Jelmer Vernooij) + * Fix compatibility with Python 3.12.1. (Matthew Treinish) + * Deprecate SkippedTest exception. (Stephen Finucane) + * Drop support for Python 3.7. (Jelmer Vernooij) +- Drop merged pytest82.patch +- Add upstream twisted.patch to fix tests with new Twisted + ------------------------------------------------------------------- Fri May 17 14:07:33 UTC 2024 - Markéta Machová diff --git a/python-testtools.spec b/python-testtools.spec index 12f5f3e..639b436 100644 --- a/python-testtools.spec +++ b/python-testtools.spec @@ -26,14 +26,14 @@ %endif %{?sle15_python_module_pythons} Name: python-testtools%{psuffix} -Version: 2.7.1 +Version: 2.7.2 Release: 0 Summary: Extensions to the Python Standard Library Unit Testing Framework License: MIT URL: https://github.com/testing-cabal/testtools Source0: https://files.pythonhosted.org/packages/source/t/testtools/testtools-%{version}.tar.gz -# PATCH-FIX-UPSTREAM https://github.com/testing-cabal/testtools/pull/373 Treat methodName="runTest" similar to unittest.TestCase -Patch: pytest82.patch +# PATCH-FIX-UPSTREAM https://github.com/testing-cabal/testtools/commit/5b8cb6497c7159f593e68de6a13e15f7e78e56e3 Prepare tests for upcoming twisted version +Patch0: twisted.patch BuildRequires: %{python_module hatch_vcs} BuildRequires: %{python_module pip} BuildRequires: %{python_module wheel} diff --git a/testtools-2.7.1.tar.gz b/testtools-2.7.1.tar.gz deleted file mode 100644 index 09f3818..0000000 --- a/testtools-2.7.1.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:df6de96010e29ee21f637a147eabf30d50b25e3841dd1d68f93ee89ce77e366c -size 200953 diff --git a/testtools-2.7.2.tar.gz b/testtools-2.7.2.tar.gz new file mode 100644 index 0000000..9863c05 --- /dev/null +++ b/testtools-2.7.2.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5be5bbc1f0fa0f8b60aca6ceec07845d41d0c475cf445bfadb4d2c45ec397ea3 +size 201430 diff --git a/twisted.patch b/twisted.patch new file mode 100644 index 0000000..cb1482d --- /dev/null +++ b/twisted.patch @@ -0,0 +1,46 @@ +From 5b8cb6497c7159f593e68de6a13e15f7e78e56e3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20Van=C4=9Bk?= +Date: Mon, 1 Jul 2024 10:00:05 +0200 +Subject: [PATCH] Prepare tests for upcoming twisted version + +Twisted recently changed behavior of logger on failures [1]. It newly +logs the `Main loop terminated.` even on exceptions, which breaks two +test in twistedsupport test suite. This hack attempts to address the +upcoming issue. + +[1] https://github.com/twisted/twisted/pull/12207 +--- + testtools/tests/twistedsupport/test_runtest.py | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/testtools/tests/twistedsupport/test_runtest.py b/testtools/tests/twistedsupport/test_runtest.py +index 4b46cc64..f8faf7c6 100644 +--- a/testtools/tests/twistedsupport/test_runtest.py ++++ b/testtools/tests/twistedsupport/test_runtest.py +@@ -16,7 +16,6 @@ + Contains, + ContainsAll, + ContainsDict, +- EndsWith, + Equals, + Is, + KeysEqual, +@@ -749,7 +748,7 @@ def test_something(self): + test, + { + "traceback": Not(Is(None)), +- "twisted-log": AsText(EndsWith(" foo\n")), ++ "twisted-log": AsText(Contains(" foo\n")), + }, + ), + ("stopTest", test), +@@ -790,7 +789,8 @@ def test_something(self): + result = self.make_result() + runner.run(result) + self.assertThat( +- messages, MatchesListwise([ContainsDict({"message": Equals(("foo",))})]) ++ messages[0:1], ++ MatchesListwise([ContainsDict({"message": Equals(("foo",))})]), + ) + + def test_restore_observers(self):