diff options
Diffstat (limited to 'dev-python/testtools')
| -rw-r--r-- | dev-python/testtools/Manifest | 2 | ||||
| -rw-r--r-- | dev-python/testtools/files/testtools-2.3.0-py37.patch | 44 | ||||
| -rw-r--r-- | dev-python/testtools/files/testtools-2.4.0-py39.patch | 76 | ||||
| -rw-r--r-- | dev-python/testtools/metadata.xml | 18 | ||||
| -rw-r--r-- | dev-python/testtools/testtools-2.3.0.ebuild | 58 | ||||
| -rw-r--r-- | dev-python/testtools/testtools-2.4.0.ebuild | 45 |
6 files changed, 243 insertions, 0 deletions
diff --git a/dev-python/testtools/Manifest b/dev-python/testtools/Manifest new file mode 100644 index 000000000000..07f0ee86df32 --- /dev/null +++ b/dev-python/testtools/Manifest @@ -0,0 +1,2 @@ +DIST testtools-2.3.0.tar.gz 231559 BLAKE2B 6ae098e368cabc0bfe45736324819687a6086eccf868de7eec312caf7c64b5d75a3168f3966d5cd0b05ad9295957a7aa1ee3c1589f076de1f5cb619b197ba08a SHA512 558fe6a1bdce7215f9f6f178f469a2b76948dc7ff0ce27400482a16683474edb81d9bf90ae48b6fcb8df9eb70759341b694aa162ed3d9d4abd372981cdcd8a64 +DIST testtools-2.4.0.tar.gz 233032 BLAKE2B 8b0559039bfc5e18dfe8d70cc10f6e43ad2e1fbebf7d20d9c6c876c5672a6149064f558150d8eb09f569b82983ffe67e06143b14a1d8869efcc585839d6216ae SHA512 af26e163a4caeb207a554b19f86c7892ab5ebe904c144d85273464e880cd18a991c70a77ff817aefb15768fa38f382e9ed853cdefb212dc697b24072e17535c0 diff --git a/dev-python/testtools/files/testtools-2.3.0-py37.patch b/dev-python/testtools/files/testtools-2.3.0-py37.patch new file mode 100644 index 000000000000..0f2da043ffe9 --- /dev/null +++ b/dev-python/testtools/files/testtools-2.3.0-py37.patch @@ -0,0 +1,44 @@ +https://github.com/testing-cabal/testtools/commit/29004731f9c480b7c44a9c2605513d50d372898f.patch + +From 29004731f9c480b7c44a9c2605513d50d372898f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz> +Date: Thu, 17 May 2018 17:52:26 +0200 +Subject: [PATCH] Fix the tests on Python 3.7 + +Exception's repr got changed not to include trailing comma + +Fixes https://github.com/testing-cabal/testtools/issues/270 +--- + .travis.yml | 1 + + testtools/tests/matchers/test_exception.py | 11 +++++++++-- + 2 files changed, 10 insertions(+), 2 deletions(-) + +diff --git a/testtools/tests/matchers/test_exception.py b/testtools/tests/matchers/test_exception.py +index 6cd80af1..acd39252 100644 +--- a/testtools/tests/matchers/test_exception.py ++++ b/testtools/tests/matchers/test_exception.py +@@ -32,15 +32,22 @@ class TestMatchesExceptionInstanceInterface(TestCase, TestMatchersInterface): + matches_matches = [error_foo] + matches_mismatches = [error_bar, error_base_foo] + ++ if sys.version_info >= (3, 7): ++ # exception's repr has changed ++ _e = '' ++ else: ++ _e = ',' ++ + str_examples = [ +- ("MatchesException(Exception('foo',))", ++ ("MatchesException(Exception('foo'%s))" % _e, + MatchesException(Exception('foo'))) + ] + describe_examples = [ + ("%r is not a %r" % (Exception, ValueError), + error_base_foo, + MatchesException(ValueError("foo"))), +- ("ValueError('bar',) has different arguments to ValueError('foo',).", ++ ("ValueError('bar'%s) has different arguments to ValueError('foo'%s)." ++ % (_e, _e), + error_bar, + MatchesException(ValueError("foo"))), + ] diff --git a/dev-python/testtools/files/testtools-2.4.0-py39.patch b/dev-python/testtools/files/testtools-2.4.0-py39.patch new file mode 100644 index 000000000000..a502e1cc0630 --- /dev/null +++ b/dev-python/testtools/files/testtools-2.4.0-py39.patch @@ -0,0 +1,76 @@ +From 1d698cf91cb2205aedc018e465a2e17c5a6a3e94 Mon Sep 17 00:00:00 2001 +From: Michel Alexandre Salim <michel@michel-slm.name> +Date: Sat, 16 May 2020 13:21:38 -0700 +Subject: [PATCH] Fix syntax error test for Python 3.9 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +On Python 3.9 the zero-width no-break space Unicode character U+FEFF +does not get printed in syntax errors. + +See: +https://bugzilla.redhat.com/show_bug.cgi?id=1831126 + +This is reproducible in a virtual environment as well. + +Before: +``` +.venv ❯ make check +PYTHONPATH=/home/michel/src/github/testing-cabal/testtools python -m testtools.run testtools.tests.test_suite +/usr/lib64/python3.9/runpy.py:127: RuntimeWarning: 'testtools.run' found in sys.modules after import of package 'testtools', but prior to execution of 'testtools.run'; this may result in unpredictable behaviour + warn(RuntimeWarning(msg)) +Tests running... +====================================================================== +FAIL: testtools.tests.test_testresult.TestNonAsciiResults.test_syntax_error_line_utf_8 +---------------------------------------------------------------------- +Traceback (most recent call last): + File "/home/michel/src/github/testing-cabal/testtools/testtools/tests/test_testresult.py", line 2744, in test_syntax_error_line_utf_8 + self.assertThat( + File "/home/michel/src/github/testing-cabal/testtools/testtools/testcase.py", line 499, in assertThat + raise mismatch_error +testtools.matchers._impl.MismatchError: 'Tests running...\n======================================================================\nERROR: test_syntax_error_line_utf_8.Test.runTest\n----------------------------------------------------------------------\nTraceback (most recent call last):\n File "/tmp/TestNonAsciiResultsblblh75h/test_syntax_error_line_utf_8.py", line 6, in runTest\n import bad\n File "/tmp/TestNonAsciiResultsblblh75h/bad.py", line 1\n \ufeff^ = 0 # paɪθən\n ^\nSyntaxError: invalid syntax\n\nRan 1 test in 0.001s\nFAILED (failures=1)\n' does not match /.*bad.py", line 1\n\s*\^ = 0 # pa\u026a\u03b8\u0259n\n \s*\^\nSyntaxError:.*/ +====================================================================== +FAIL: testtools.tests.test_testresult.TestNonAsciiResultsWithUnittest.test_syntax_error_line_utf_8 +---------------------------------------------------------------------- +Traceback (most recent call last): + File "/home/michel/src/github/testing-cabal/testtools/testtools/tests/test_testresult.py", line 2744, in test_syntax_error_line_utf_8 + self.assertThat( + File "/home/michel/src/github/testing-cabal/testtools/testtools/testcase.py", line 499, in assertThat + raise mismatch_error +testtools.matchers._impl.MismatchError: 'E\n======================================================================\nERROR: runTest (test_syntax_error_line_utf_8.Test)\ntest_syntax_error_line_utf_8.Test.runTest\n----------------------------------------------------------------------\ntesttools.testresult.real._StringException: Traceback (most recent call last):\n File "/tmp/TestNonAsciiResultsWithUnittest_zzswpmj/test_syntax_error_line_utf_8.py", line 6, in runTest\n import bad\n File "/tmp/TestNonAsciiResultsWithUnittest_zzswpmj/bad.py", line 1\n \ufeff^ = 0 # paɪθən\n ^\nSyntaxError: invalid syntax\n\n\n----------------------------------------------------------------------\nRan 1 test in 0.000s\n\nFAILED (errors=1)\n' does not match /.*bad.py", line 1\n\s*\^ = 0 # pa\u026a\u03b8\u0259n\n \s*\^\nSyntaxError:.*/ + +Ran 2627 tests in 0.569s +FAILED (failures=2) +make: *** [Makefile:7: check] Error 1 +``` + +After: +``` +.venv ❯ make check +PYTHONPATH=/home/michel/src/github/testing-cabal/testtools python -m testtools.run testtools.tests.test_suite +/usr/lib64/python3.9/runpy.py:127: RuntimeWarning: 'testtools.run' found in sys.modules after import of package 'testtools', but prior to execution of 'testtools.run'; this may result in unpredictable behaviour + warn(RuntimeWarning(msg)) +Tests running... + +Ran 2627 tests in 0.492s +OK +``` +--- + testtools/tests/test_testresult.py | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/testtools/tests/test_testresult.py b/testtools/tests/test_testresult.py +index 3bbd8937..deceb07d 100644 +--- a/testtools/tests/test_testresult.py ++++ b/testtools/tests/test_testresult.py +@@ -2741,6 +2741,9 @@ def test_syntax_error_line_utf_8(self): + textoutput = self._setup_external_case("import bad") + self._write_module("bad", "utf-8", "\ufeff^ = 0 # %s\n" % text) + textoutput = self._run_external_case() ++ # Python 3.9 no longer prints the '\ufeff' ++ if sys.version_info >= (3,9): ++ textoutput = textoutput.replace('\ufeff', '') + self.assertThat( + textoutput, + MatchesRegex( diff --git a/dev-python/testtools/metadata.xml b/dev-python/testtools/metadata.xml new file mode 100644 index 000000000000..15f67fc48bf8 --- /dev/null +++ b/dev-python/testtools/metadata.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="project"> + <email>python@gentoo.org</email> + <name>Python</name> + </maintainer> + <maintainer type="project"> + <email>openstack@gentoo.org</email> + <name>Openstack</name> + </maintainer> + <upstream> + <remote-id type="pypi">testtools</remote-id> + <remote-id type="github">testing-cabal/testtools</remote-id> + <remote-id type="launchpad">testtools</remote-id> + </upstream> + <origin>gentoo-staging</origin> +</pkgmetadata> diff --git a/dev-python/testtools/testtools-2.3.0.ebuild b/dev-python/testtools/testtools-2.3.0.ebuild new file mode 100644 index 000000000000..d7d7f476c5bc --- /dev/null +++ b/dev-python/testtools/testtools-2.3.0.ebuild @@ -0,0 +1,58 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +PYTHON_COMPAT=( python2_7 python3_6 python3_7 python3_8 pypy3 ) +PYTHON_REQ_USE="threads(+)" + +inherit distutils-r1 + +DESCRIPTION="Extensions to the Python standard library unit testing framework" +HOMEPAGE="https://github.com/testing-cabal/testtools" +SRC_URI="mirror://pypi/${P:0:1}/${PN}/${P}.tar.gz" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 s390 sparc x86 ~amd64-linux ~x86-linux" +IUSE="doc test" +RESTRICT="!test? ( test )" + +CDEPEND=" + >=dev-python/extras-1.0.0[${PYTHON_USEDEP}] + dev-python/python-mimeparse[${PYTHON_USEDEP}] + >=dev-python/pbr-0.11[${PYTHON_USEDEP}] + dev-python/pyrsistent[${PYTHON_USEDEP}] + >=dev-python/six-1.4.0[${PYTHON_USEDEP}] + dev-python/traceback2[${PYTHON_USEDEP}] + >=dev-python/unittest2-1.0.0[${PYTHON_USEDEP}] +" +DEPEND=" + dev-python/setuptools[${PYTHON_USEDEP}] + ${CDEPEND} + doc? ( dev-python/sphinx[${PYTHON_USEDEP}] ) + test? ( + >=dev-python/fixtures-1.3.0[${PYTHON_USEDEP}] + dev-python/testscenarios[${PYTHON_USEDEP}] + ) +" +RDEPEND="${CDEPEND}" +PDEPEND=">=dev-python/fixtures-1.3.0[${PYTHON_USEDEP}]" + +PATCHES=( + "${FILESDIR}"/testtools-2.3.0-py37.patch +) + +python_compile_all() { + use doc && emake -C doc html +} + +python_test() { + "${PYTHON}" -m testtools.run testtools.tests.test_suite || die "tests failed under ${EPYTHON}" +} + +python_install_all() { + use doc && HTML_DOCS=( doc/_build/html/. ) + + distutils-r1_python_install_all +} diff --git a/dev-python/testtools/testtools-2.4.0.ebuild b/dev-python/testtools/testtools-2.4.0.ebuild new file mode 100644 index 000000000000..41097304bed4 --- /dev/null +++ b/dev-python/testtools/testtools-2.4.0.ebuild @@ -0,0 +1,45 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( python2_7 python3_{6..9} pypy3 ) +PYTHON_REQ_USE="threads(+)" + +inherit distutils-r1 + +DESCRIPTION="Extensions to the Python standard library unit testing framework" +HOMEPAGE="https://github.com/testing-cabal/testtools" +SRC_URI="mirror://pypi/${P:0:1}/${PN}/${P}.tar.gz" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux" + +RDEPEND=" + >=dev-python/extras-1.0.0[${PYTHON_USEDEP}] + dev-python/python-mimeparse[${PYTHON_USEDEP}] + >=dev-python/pbr-0.11[${PYTHON_USEDEP}] + dev-python/pyrsistent[${PYTHON_USEDEP}] + >=dev-python/six-1.4.0[${PYTHON_USEDEP}] + dev-python/traceback2[${PYTHON_USEDEP}] + >=dev-python/unittest2-1.0.0[${PYTHON_USEDEP}] +" +DEPEND=" + test? ( + >=dev-python/fixtures-1.3.0[${PYTHON_USEDEP}] + dev-python/testscenarios[${PYTHON_USEDEP}] + ) +" +PDEPEND=">=dev-python/fixtures-1.3.0[${PYTHON_USEDEP}]" + +PATCHES=( + "${FILESDIR}"/testtools-2.4.0-py39.patch +) + +distutils_enable_sphinx doc +distutils_enable_tests unittest + +python_test() { + "${PYTHON}" -m testtools.run testtools.tests.test_suite || die "tests failed under ${EPYTHON}" +} |
