summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2022-04-28 12:14:55 +0200
committerMichał Górny <mgorny@gentoo.org>2022-04-28 12:16:32 +0200
commit2adba3989fc3d1723eb6534ae0bc1aeaf1513cfa (patch)
tree2f1b6642ba2ecc5717d16ab69a16a8f9c0d9a51f
parent9dfd65aad70990c1e08b3ac3f060f9da2073daee (diff)
downloadfixtures-git-2adba3989fc3d1723eb6534ae0bc1aeaf1513cfa.tar.gz
Revert to the previous classmethod expectations for PyPy3.9
Commit fe83067 has changed TestMonkeyPatch to account for changes in classmethod handling in CPython 3.9. Unfortunately, this broke the tests on PyPy3.9. Revert to the old expectations when using PyPy. Fixes #64
-rw-r--r--fixtures/tests/_fixtures/test_monkeypatch.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/fixtures/tests/_fixtures/test_monkeypatch.py b/fixtures/tests/_fixtures/test_monkeypatch.py
index 746f6dd..08cd1c8 100644
--- a/fixtures/tests/_fixtures/test_monkeypatch.py
+++ b/fixtures/tests/_fixtures/test_monkeypatch.py
@@ -23,6 +23,9 @@ from fixtures import MonkeyPatch, TestWithFixtures
reference = 23
+NEW_PY39_CLASSMETHOD = (
+ sys.version_info >= (3, 9) and not hasattr(sys, "pypy_version_info"))
+
class C(object):
def foo(self, arg):
return arg
@@ -196,7 +199,7 @@ class TestMonkeyPatch(testtools.TestCase, TestWithFixtures):
# with the class
#
# https://bugs.python.org/issue19072
- if sys.version_info >= (3, 9):
+ if NEW_PY39_CLASSMETHOD:
cls, = C.foo_cls()
self.expectThat(cls, Is(D))
cls, = C().foo_cls()
@@ -238,13 +241,13 @@ class TestMonkeyPatch(testtools.TestCase, TestWithFixtures):
self.expectThat(slf, Is(d))
# See note in test_patch_classmethod_with_classmethod on changes in
# Python 3.9
- if sys.version_info >= (3, 9):
+ if NEW_PY39_CLASSMETHOD:
self.expectThat(cls, Is(None))
else:
self.expectThat(cls, Is(C))
slf, cls = C().foo_cls()
self.expectThat(slf, Is(d))
- if sys.version_info >= (3, 9):
+ if NEW_PY39_CLASSMETHOD:
self.expectThat(cls, Is(None))
else:
self.expectThat(cls, Is(C))