From 198eb85d3a3011c2649d0c48aec38f05a3048506 Mon Sep 17 00:00:00 2001 From: Michał Górny Date: Sun, 31 May 2020 16:57:59 +0200 Subject: dev-python/testtools: Bump to 2.4.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Górny --- dev-python/testtools/Manifest | 1 + .../testtools/files/testtools-2.4.0-py39.patch | 76 ++++++++++++++++++++++ dev-python/testtools/testtools-2.4.0.ebuild | 45 +++++++++++++ 3 files changed, 122 insertions(+) create mode 100644 dev-python/testtools/files/testtools-2.4.0-py39.patch create mode 100644 dev-python/testtools/testtools-2.4.0.ebuild (limited to 'dev-python/testtools') diff --git a/dev-python/testtools/Manifest b/dev-python/testtools/Manifest index 04cb4cdd6ce9..07f0ee86df32 100644 --- a/dev-python/testtools/Manifest +++ b/dev-python/testtools/Manifest @@ -1 +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.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 +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/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}" +} -- cgit v1.2.3-65-gdbad