diff --git a/dev-python/aspectlib/aspectlib-1.5.2.ebuild b/dev-python/aspectlib/aspectlib-1.5.2.ebuild index 843c2fa..7a71fd6 100644 --- a/dev-python/aspectlib/aspectlib-1.5.2.ebuild +++ b/dev-python/aspectlib/aspectlib-1.5.2.ebuild @@ -1,9 +1,9 @@ # Copyright 2021 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -EAPI=7 +EAPI=8 -PYTHON_COMPAT=( python3_{8..9} ) +PYTHON_COMPAT=( python3_{8..10} ) inherit distutils-r1 DESCRIPTION="An aspect-oriented programming, monkey-patch and decorators library." @@ -31,7 +31,10 @@ BDEPEND=" distutils_enable_tests pytest -PATCHES=( "${FILESDIR}/Remove-tornado-6-test-constraint.patch" ) +PATCHES=( + "${FILESDIR}/Fix-tests-for-python3_10.patch" + "${FILESDIR}/Remove-tornado-6-test-constraint.patch" +) python_compile_all() { if use doc; then diff --git a/dev-python/aspectlib/files/Fix-tests-for-python3_10.patch b/dev-python/aspectlib/files/Fix-tests-for-python3_10.patch new file mode 100644 index 0000000..2c248e5 --- /dev/null +++ b/dev-python/aspectlib/files/Fix-tests-for-python3_10.patch @@ -0,0 +1,68 @@ +diff --git a/src/aspectlib/__init__.py b/src/aspectlib/__init__.py +index b85f1dd..b7d0f70 100644 +--- a/src/aspectlib/__init__.py ++++ b/src/aspectlib/__init__.py +@@ -18,6 +18,7 @@ from logging import getLogger + from .utils import PY2 + from .utils import PY3 + from .utils import PY37plus ++from .utils import PY310 + from .utils import Sentinel + from .utils import basestring + from .utils import force_bind +diff --git a/src/aspectlib/utils.py b/src/aspectlib/utils.py +index 9e0837e..b08f2d6 100644 +--- a/src/aspectlib/utils.py ++++ b/src/aspectlib/utils.py +@@ -13,6 +13,7 @@ RegexType = type(re.compile("")) + + PY3 = sys.version_info[0] == 3 + PY37plus = PY3 and sys.version_info[1] >= 7 ++PY310 = PY3 and sys.version_info[1] == 10 + PY2 = sys.version_info[0] == 2 + PY26 = PY2 and sys.version_info[1] == 6 + PYPY = platform.python_implementation() == 'PyPy' +diff --git a/tests/test_aspectlib_test.py b/tests/test_aspectlib_test.py +index 05e2c25..37fe8e8 100644 +--- a/tests/test_aspectlib_test.py ++++ b/tests/test_aspectlib_test.py +@@ -4,6 +4,7 @@ from pytest import raises + from test_pkg1.test_pkg2 import test_mod + + from aspectlib import PY2 ++from aspectlib import PY310 + from aspectlib.test import OrderedDict + from aspectlib.test import Story + from aspectlib.test import StoryResultWrapper +@@ -414,6 +415,7 @@ def test_story_empty_play_proxy_class(): + (('stuff_1', 'mix', "'a', 'b'", ''), _Returns("(1, 2, 'a', 'b')")), + (('stuff_1', 'meth', "123", ''), _Raises(repr_ex(TypeError( + 'meth() takes exactly 1 argument (2 given)' if PY2 else ++ 'Stuff.meth() takes 1 positional argument but 2 were given' if PY310 else + 'meth() takes 1 positional argument but 2 were given' + )))), + ((None, 'test_pkg1.test_pkg2.test_mod.Stuff', "0, 1", ''), _Binds('stuff_2')), +@@ -421,6 +423,7 @@ def test_story_empty_play_proxy_class(): + (('stuff_2', 'mix', "3, 4", ''), _Returns("(0, 1, 3, 4)")), + (('stuff_2', 'meth', "123", ''), _Raises(repr_ex(TypeError( + 'meth() takes exactly 1 argument (2 given)' if PY2 else ++ 'Stuff.meth() takes 1 positional argument but 2 were given' if PY310 else + 'meth() takes 1 positional argument but 2 were given' + )))) + ])) +@@ -449,6 +452,7 @@ def test_story_half_play_proxy_class(): + (('stuff_1', 'meth', '', ''), _Returns('None')), + (('stuff_1', 'meth', '123', ''), _Raises(repr_ex(TypeError( + 'meth() takes exactly 1 argument (2 given)' if PY2 else ++ 'Stuff.meth() takes 1 positional argument but 2 were given' if PY310 else + 'meth() takes 1 positional argument but 2 were given' + )))), + ((None, 'test_pkg1.test_pkg2.test_mod.Stuff', '0, 1', ''), _Binds("stuff_2")), +@@ -456,6 +460,7 @@ def test_story_half_play_proxy_class(): + (('stuff_2', 'mix', '3, 4', ''), _Returns('(0, 1, 3, 4)')), + (('stuff_2', 'meth', '123', ''), _Raises(repr_ex(TypeError( + 'meth() takes exactly 1 argument (2 given)' if PY2 else ++ 'Stuff.meth() takes 1 positional argument but 2 were given' if PY310 else + 'meth() takes 1 positional argument but 2 were given' + )))) + ]))