diff options
Diffstat (limited to 'dev-python/testfixtures')
-rw-r--r-- | dev-python/testfixtures/Manifest | 3 | ||||
-rw-r--r-- | dev-python/testfixtures/files/testfixtures-6.18.1-py3.10.patch | 172 | ||||
-rw-r--r-- | dev-python/testfixtures/testfixtures-6.18.1.ebuild | 46 |
3 files changed, 221 insertions, 0 deletions
diff --git a/dev-python/testfixtures/Manifest b/dev-python/testfixtures/Manifest index 14bd1833785f..234d84f43333 100644 --- a/dev-python/testfixtures/Manifest +++ b/dev-python/testfixtures/Manifest @@ -1,3 +1,6 @@ +AUX testfixtures-6.18.1-py3.10.patch 6506 BLAKE2B 09db867dfaf8b76098681ce2b74731a8224b54e72b96362a34187e3e55309095bac8459d40b3c54fc6cedebe13c9f76ac9cc18ff43c2bf9e88b9dbfa369dff5a SHA512 d91b46005525cbefa2100eee25720b1229c6ca8213aaf36578635ffc82edc50aeef278d8e009d13bdb14ab791d7969b5fd39ae70fb2becce8f255edee1256792 DIST testfixtures-6.18.0.tar.gz 121584 BLAKE2B abf90012fe79d148c44d72a8aaa5277c95a33933c7b753eecdcaeb11279b4439ad9ea394270e440d9681c22789a17738d367b66adf3d04cf6e6289713c1ead59 SHA512 e6552e6b1837ae4ee4754ce3675bdbf2a68d8e46b892382bd8320290050f2c296348ef6310ce3ff46962bf1978c351fe2cdb853a73c9f800f68818f81d5caec9 +DIST testfixtures-6.18.1.tar.gz 121731 BLAKE2B c31873d3ebbe47d5d3035d6aaaf674472efb32b061080df711ee558bf91d1b01d417ded4eaebf7436132fd7b9233437e735fa60dee47777d032fc1b610fd1de3 SHA512 088c6480eecc9862e91a0188ab45620be3d8f8898ebb284dc932155fffbd9f75ebbab9425fe4db8dee75ee8fcf82d8c27b950a3f9298e9f7ca420744c65edd91 EBUILD testfixtures-6.18.0.ebuild 1107 BLAKE2B 6fc7510546cb7d9242044516a61f02aaf8c332f15d304427959b3472369aaa8085996b938e9b099b44a3b14b0600d5886e64769e201e163259138914f06962b0 SHA512 dc79e500f56f3c838951d2b94ac0b00c663901572ebeee920ff1ed81895d219e6187c180052e9311dae85406e986916eb92a149e2f213c3e9e0c816436dabd99 +EBUILD testfixtures-6.18.1.ebuild 1250 BLAKE2B 86cfce299416317e4c16fb549d15c4388eb8b28b250081b6247686bbd26fa5ff7319045bc2025a3ac20854550c00f91e1b57572100b82110846c8561c6d7ab36 SHA512 5654831168434f1a084df1b5c29ff1c76ba7f9d2e008f49649e319c26264bc4b1ce4fb3f07ceb00e2db111eb529cf28591c7678cf58c1a0cbe555bcbcfdb12ba MISC metadata.xml 415 BLAKE2B d3e133602f86d013faf5998b2e52256dca88ed9593b9ea26bed0277b70823eda4dd27deca7488a7f66fac2f77e3312cddf833a4b865cf400c7e78a4d267a4c5b SHA512 78fd16b4fd4e8ea3f244b3d8fcce8451a38713d0374df3d2661453f2ad06af587b4613c9119b11bf4cfe3d226fd04620bfa74f58f2660e44ba7e84b93c99c20e diff --git a/dev-python/testfixtures/files/testfixtures-6.18.1-py3.10.patch b/dev-python/testfixtures/files/testfixtures-6.18.1-py3.10.patch new file mode 100644 index 000000000000..cd1ecbd8133d --- /dev/null +++ b/dev-python/testfixtures/files/testfixtures-6.18.1-py3.10.patch @@ -0,0 +1,172 @@ +From 8fb2122eea0f1d0de1ccca7a3a0f5426bc6d4964 Mon Sep 17 00:00:00 2001 +From: Louis Sautier <sautier.louis@gmail.com> +Date: Sat, 21 Aug 2021 03:00:51 +0200 +Subject: [PATCH] tests: fix with Python 3.10 (changed exception messages) + +--- + testfixtures/compat.py | 1 + + testfixtures/tests/test_popen.py | 41 ++++++++++++++++++------------ + testfixtures/tests/test_replace.py | 24 ++++++++++------- + 3 files changed, 41 insertions(+), 25 deletions(-) + +diff --git a/testfixtures/compat.py b/testfixtures/compat.py +index 1042d27..ca00f32 100644 +--- a/testfixtures/compat.py ++++ b/testfixtures/compat.py +@@ -5,6 +5,7 @@ + + PY_36_PLUS = PY_VERSION >= (3, 6) + PY_37_PLUS = PY_VERSION >= (3, 7) ++PY_310_PLUS = PY_VERSION >= (3, 10) + + + if PY_VERSION > (3, 0): +diff --git a/testfixtures/tests/test_popen.py b/testfixtures/tests/test_popen.py +index aa211da..4ec3186 100644 +--- a/testfixtures/tests/test_popen.py ++++ b/testfixtures/tests/test_popen.py +@@ -6,7 +6,7 @@ + from testfixtures import ShouldRaise, compare, Replacer + + from testfixtures.popen import MockPopen, PopenBehaviour +-from testfixtures.compat import BytesLiteral, PY2 ++from testfixtures.compat import BytesLiteral, PY2, PY_310_PLUS + + import signal + +@@ -471,10 +471,11 @@ def test_default_command_max_args(self): + ], Popen.mock.method_calls) + + def test_invalid_parameters(self): ++ message = "__init__() got an unexpected keyword argument 'foo'" ++ if PY_310_PLUS: ++ message = "MockPopenInstance." + message + Popen = MockPopen() +- with ShouldRaise(TypeError( +- "__init__() got an unexpected keyword argument 'foo'" +- )): ++ with ShouldRaise(TypeError(message)): + Popen(foo='bar') + + def test_invalid_method_or_attr(self): +@@ -492,39 +493,43 @@ def test_invalid_attribute(self): + process.foo + + def test_invalid_communicate_call(self): ++ message = "communicate() got an unexpected keyword argument 'foo'" ++ if PY_310_PLUS: ++ message = "MockPopenInstance." + message + Popen = MockPopen() + Popen.set_command('bar') + process = Popen('bar') +- with ShouldRaise(TypeError( +- "communicate() got an unexpected keyword argument 'foo'" +- )): ++ with ShouldRaise(TypeError(message)): + process.communicate(foo='bar') + + def test_invalid_wait_call(self): ++ message = "wait() got an unexpected keyword argument 'foo'" ++ if PY_310_PLUS: ++ message = "MockPopenInstance." + message + Popen = MockPopen() + Popen.set_command('bar') + process = Popen('bar') +- with ShouldRaise(TypeError( +- "wait() got an unexpected keyword argument 'foo'" +- )): ++ with ShouldRaise(TypeError(message)): + process.wait(foo='bar') + + def test_invalid_send_signal(self): ++ message = "send_signal() got an unexpected keyword argument 'foo'" ++ if PY_310_PLUS: ++ message = "MockPopenInstance." + message + Popen = MockPopen() + Popen.set_command('bar') + process = Popen('bar') +- with ShouldRaise(TypeError( +- "send_signal() got an unexpected keyword argument 'foo'" +- )): ++ with ShouldRaise(TypeError(message)): + process.send_signal(foo='bar') + + def test_invalid_terminate(self): ++ message = "terminate() got an unexpected keyword argument 'foo'" ++ if PY_310_PLUS: ++ message = "MockPopenInstance." + message + Popen = MockPopen() + Popen.set_command('bar') + process = Popen('bar') +- with ShouldRaise(TypeError( +- "terminate() got an unexpected keyword argument 'foo'" +- )): ++ with ShouldRaise(TypeError(message)): + process.terminate(foo='bar') + + def test_invalid_kill(self): +@@ -535,6 +540,8 @@ def test_invalid_kill(self): + text = 'kill() takes exactly 1 argument (2 given)' + else: + text = 'kill() takes 1 positional argument but 2 were given' ++ if PY_310_PLUS: ++ text = "MockPopenInstance." + text + with ShouldRaise(TypeError(text)): + process.kill('moo') + +@@ -546,6 +553,8 @@ def test_invalid_poll(self): + text = 'poll() takes exactly 1 argument (2 given)' + else: + text = 'poll() takes 1 positional argument but 2 were given' ++ if PY_310_PLUS: ++ text = "MockPopenInstance." + text + with ShouldRaise(TypeError(text)): + process.poll('moo') + +diff --git a/testfixtures/tests/test_replace.py b/testfixtures/tests/test_replace.py +index 5a77e23..d3544a8 100644 +--- a/testfixtures/tests/test_replace.py ++++ b/testfixtures/tests/test_replace.py +@@ -13,7 +13,7 @@ + + from testfixtures.tests import sample1 + from testfixtures.tests import sample2 +-from ..compat import PY3 ++from ..compat import PY3, PY_310_PLUS + + from warnings import catch_warnings + +@@ -259,19 +259,25 @@ def test_something(obj): + self.failIf(hasattr(sample1, 'foo')) + + def test_replace_delattr_cant_remove(self): ++ if PY_310_PLUS: ++ message = "cannot set 'today' attribute of " \ ++ "immutable type 'datetime.datetime'" ++ else: ++ message = "can't set attributes of " \ ++ "built-in/extension type 'datetime.datetime'" + with Replacer() as r: +- with ShouldRaise(TypeError( +- "can't set attributes of " +- "built-in/extension type 'datetime.datetime'" +- )): ++ with ShouldRaise(TypeError(message)): + r.replace('datetime.datetime.today', not_there) + + def test_replace_delattr_cant_remove_not_strict(self): ++ if PY_310_PLUS: ++ message = "cannot set 'today' attribute of " \ ++ "immutable type 'datetime.datetime'" ++ else: ++ message = "can't set attributes of " \ ++ "built-in/extension type 'datetime.datetime'" + with Replacer() as r: +- with ShouldRaise(TypeError( +- "can't set attributes of " +- "built-in/extension type 'datetime.datetime'" +- )): ++ with ShouldRaise(TypeError(message)): + r.replace('datetime.datetime.today', not_there, strict=False) + + def test_replace_dict_remove_key(self): diff --git a/dev-python/testfixtures/testfixtures-6.18.1.ebuild b/dev-python/testfixtures/testfixtures-6.18.1.ebuild new file mode 100644 index 000000000000..09d57b662b87 --- /dev/null +++ b/dev-python/testfixtures/testfixtures-6.18.1.ebuild @@ -0,0 +1,46 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{8..10} ) +inherit distutils-r1 + +DESCRIPTION="A collection of helpers and mock objects for unit tests and doc tests" +HOMEPAGE="https://pypi.org/project/testfixtures/ https://github.com/Simplistix/testfixtures" +SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz" + +SLOT="0" +LICENSE="MIT" +KEYWORDS="~amd64 ~arm ~arm64 ~riscv ~x86 ~amd64-linux ~x86-linux" + +BDEPEND=" + test? ( + $(python_gen_impl_dep sqlite) + dev-python/django[${PYTHON_USEDEP}] + dev-python/pytest-django[${PYTHON_USEDEP}] + dev-python/sybil[${PYTHON_USEDEP}] + >=dev-python/twisted-18[${PYTHON_USEDEP}] + dev-python/zope-component[${PYTHON_USEDEP}] + )" + +distutils_enable_sphinx docs +distutils_enable_tests pytest + +PATCHES=( + # https://github.com/Simplistix/testfixtures/commit/8fb2122eea0f1d0de1ccca7a3a0f5426bc6d4964 + "${FILESDIR}/${P}-py3.10.patch" +) + +python_prepare_all() { + # kill weird way of declaring build deps + sed -e '/build=/d' -i setup.py || die + + distutils-r1_python_prepare_all +} + +python_test() { + local -x PYTHONPATH="." + local -x DJANGO_SETTINGS_MODULE=testfixtures.tests.test_django.settings + epytest -Wignore::DeprecationWarning +} |