58 lines
2.6 KiB
Diff
58 lines
2.6 KiB
Diff
diff --git a/tests.py b/tests.py
|
|
index fc2ee7f..d494470 100755
|
|
--- a/tests.py
|
|
+++ b/tests.py
|
|
@@ -11,6 +11,7 @@ import tempfile
|
|
import textwrap
|
|
import types
|
|
import unittest
|
|
+import platform
|
|
|
|
# setuptools imports `imp`, which triggers a DeprecationWarning starting with
|
|
# Python 3.4 in the middle of my pristine test suite. But if I do the import
|
|
@@ -363,7 +364,7 @@ def doctest_get_new_ids_prints():
|
|
========================================================
|
|
Type Old_ids Current_ids New_ids Count_Deltas
|
|
========================================================
|
|
- list ... ... ... +2
|
|
+ wt ... ... ... +2
|
|
========================================================
|
|
|
|
"""
|
|
@@ -387,7 +388,10 @@ class ByTypeTest(GarbageCollectedMixin, unittest.TestCase):
|
|
# 2. the `res` list
|
|
# referrers we don't want:
|
|
# the ``objects`` list in the now-dead stack frame of objgraph.by_type
|
|
- self.assertLessEqual(len(gc.get_referrers(res[0])), 2)
|
|
+ if 'pypy' in platform.python_implementation().lower():
|
|
+ self.assertLessEqual(len(gc.get_referrers(res[0])), 3)
|
|
+ else:
|
|
+ self.assertLessEqual(len(gc.get_referrers(res[0])), 2)
|
|
|
|
|
|
class AtAddrsTest(unittest.TestCase):
|
|
@@ -439,7 +443,10 @@ class StringRepresentationTest(GarbageCollectedMixin,
|
|
obj = MyClass()
|
|
with mock.patch.object(obj, 'my_method',
|
|
types.MethodType(mock_method, obj)):
|
|
- self.assertRegex(objgraph._short_repr(obj.my_method), '<Mock')
|
|
+ if 'pypy' in platform.python_implementation().lower():
|
|
+ self.assertRegex(objgraph._short_repr(obj.my_method), '<bound method')
|
|
+ else:
|
|
+ self.assertRegex(objgraph._short_repr(obj.my_method), '<Mock')
|
|
|
|
def test_short_repr_mocked_name(self):
|
|
self.assertRegex(objgraph._short_repr(mock.Mock(__name__=mock.Mock())),
|
|
@@ -462,7 +469,10 @@ class StringRepresentationTest(GarbageCollectedMixin,
|
|
obj = MyClass()
|
|
with mock.patch.object(obj, 'my_method',
|
|
types.MethodType(mock_method, obj)):
|
|
- self.assertRegex(objgraph._short_repr(obj.my_method), '<Mock')
|
|
+ if 'pypy' in platform.python_implementation().lower():
|
|
+ self.assertRegex(objgraph._short_repr(obj.my_method), '<bound method')
|
|
+ else:
|
|
+ self.assertRegex(objgraph._short_repr(obj.my_method), '<Mock')
|
|
|
|
@skipIf(sys.version_info[0] > 2, "Python 3 has no unbound methods")
|
|
def test_short_repr_unbound_method(self):
|