--- /dev/null
+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):
--- /dev/null
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6,7,8} pypy3 )
+
+inherit distutils-r1
+
+DESCRIPTION="Draws Python object reference graphs with graphviz"
+HOMEPAGE="https://mg.pov.lt/objgraph/"
+SRC_URI="mirror://pypi/o/${PN}/${P}.tar.gz"
+
+LICENSE="MIT"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+SLOT="0"
+IUSE="doc test"
+RESTRICT="!test? ( test )"
+
+RDEPEND="media-gfx/graphviz"
+DEPEND="dev-python/setuptools
+ test? ( media-gfx/xdot )"
+
+PATCHES=(
+ "${FILESDIR}/objgraph-3.4.1-tests.patch"
+)
+
+distutils_enable_tests unittest
+
+python_install_all() {
+ use doc && local HTML_DOCS=( docs/* )
+ distutils-r1_python_install_all
+}