diff options
author | Colin Watson <cjwatson@debian.org> | 2022-12-10 17:31:35 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2022-12-10 17:31:35 +0000 |
commit | 358cdc8d2bf911e9be6ff8733c98e862627ecc8a (patch) | |
tree | 57cd48e30d93b151e2e73d5043a730ffd441f082 | |
parent | 0ce63319c147dedfc19d40b1b73d7cf8df74ef41 (diff) | |
download | zope-interface-358cdc8d2bf911e9be6ff8733c98e862627ecc8a.tar.gz |
Fix test deprecation warning on Python 3.11
Python 3.11 warns:
DeprecationWarning: It is deprecated to return a value that is not
None from a test case (<bound method Test_c3_ro.test_complex_diamond
of <zope.interface.tests.test_ro.Test_c3_ro
testMethod=test_complex_diamond>>)
Rearrange slightly to avoid this.
-rw-r--r-- | CHANGES.rst | 2 | ||||
-rw-r--r-- | src/zope/interface/tests/test_ro.py | 11 |
2 files changed, 9 insertions, 4 deletions
diff --git a/CHANGES.rst b/CHANGES.rst index cb6040c..fdfea8c 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,6 +5,8 @@ 5.5.3 (unreleased) ================== +- Fix test deprecation warning on Python 3.11. + 5.5.2 (2022-11-17) ================== diff --git a/src/zope/interface/tests/test_ro.py b/src/zope/interface/tests/test_ro.py index 5542d28..81b1b71 100644 --- a/src/zope/interface/tests/test_ro.py +++ b/src/zope/interface/tests/test_ro.py @@ -202,7 +202,7 @@ class Test_c3_ro(Test_ro): from zope.interface.ro import ro return ro(ob, **kwargs) - def test_complex_diamond(self, base=object): + def _make_complex_diamond(self, base): # https://github.com/zopefoundation/zope.interface/issues/21 O = base class F(O): @@ -223,10 +223,13 @@ class Test_c3_ro(Test_ro): return A + def test_complex_diamond_object(self): + self._make_complex_diamond(object) + def test_complex_diamond_interface(self): from zope.interface import Interface - IA = self.test_complex_diamond(Interface) + IA = self._make_complex_diamond(Interface) self.assertEqual( [x.__name__ for x in IA.__iro__], @@ -236,7 +239,7 @@ class Test_c3_ro(Test_ro): def test_complex_diamond_use_legacy_argument(self): from zope.interface import Interface - A = self.test_complex_diamond(Interface) + A = self._make_complex_diamond(Interface) legacy_A_iro = self._callFUT(A, use_legacy_ro=True) self.assertNotEqual(A.__iro__, legacy_A_iro) @@ -246,7 +249,7 @@ class Test_c3_ro(Test_ro): def test_complex_diamond_compare_legacy_argument(self): from zope.interface import Interface - A = self.test_complex_diamond(Interface) + A = self._make_complex_diamond(Interface) computed_A_iro = self._callFUT(A, log_changed_ro=True) # It matches, of course, but we did log a warning. self.assertEqual(tuple(computed_A_iro), A.__iro__) |