summaryrefslogtreecommitdiff
path: root/dev-python/fixtures/files/fixtures-4.0.0-pypy39.patch
blob: dfe7bade82fa875bcd8f5f69a35b8d0a72c157ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
From 2adba3989fc3d1723eb6534ae0bc1aeaf1513cfa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Thu, 28 Apr 2022 12:14:55 +0200
Subject: [PATCH] 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
---
 fixtures/tests/_fixtures/test_monkeypatch.py | 9 ++++++---
 1 file 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))
-- 
2.35.1