Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-testtools for 
openSUSE:Factory checked in at 2024-05-21 18:34:39
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-testtools (Old)
 and      /work/SRC/openSUSE:Factory/.python-testtools.new.1880 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-testtools"

Tue May 21 18:34:39 2024 rev:35 rq:1175385 version:2.7.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-testtools/python-testtools.changes        
2024-05-09 12:08:12.134592206 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-testtools.new.1880/python-testtools.changes  
    2024-05-21 18:35:00.343240010 +0200
@@ -1,0 +2,5 @@
+Fri May 17 14:07:33 UTC 2024 - Markéta Machová <[email protected]>
+
+- Add pytest82.patch to fix functionality with the new pytest.
+
+-------------------------------------------------------------------

New:
----
  pytest82.patch

BETA DEBUG BEGIN:
  New:
- Add pytest82.patch to fix functionality with the new pytest.
BETA DEBUG END:

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-testtools.spec ++++++
--- /var/tmp/diff_new_pack.nd804x/_old  2024-05-21 18:35:00.783256005 +0200
+++ /var/tmp/diff_new_pack.nd804x/_new  2024-05-21 18:35:00.787256150 +0200
@@ -32,6 +32,8 @@
 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
 BuildRequires:  %{python_module hatch_vcs}
 BuildRequires:  %{python_module pip}
 BuildRequires:  %{python_module wheel}
@@ -58,7 +60,7 @@
 also ports recent unittest changes all the way back to Python 2.4.
 
 %prep
-%setup -q -n testtools-%{version}
+%autosetup -p1 -n testtools-%{version}
 
 %if !%{with test}
 %build

++++++ pytest82.patch ++++++
>From 91e617a5c0bb220779b1d9912f3e946a28be53d4 Mon Sep 17 00:00:00 2001
From: Natanael Copa <[email protected]>
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.

Reply via email to