diff options
author | 2023-05-29 15:56:14 +0100 | |
---|---|---|
committer | 2023-05-29 16:04:42 +0100 | |
commit | 4e53837fea3abb80950d3d31abe7ba6ab57c5ee4 (patch) | |
tree | 67202c3c98a558d7211d78b25d6d0f447f6328cf /dev-python | |
parent | dev-python/poetry-core: Enable testing on py3.12 (diff) | |
download | gentoo-4e53837fea3abb80950d3d31abe7ba6ab57c5ee4.tar.gz gentoo-4e53837fea3abb80950d3d31abe7ba6ab57c5ee4.tar.bz2 gentoo-4e53837fea3abb80950d3d31abe7ba6ab57c5ee4.zip |
dev-python/webtest: add py3.12 patch, no py3.12 yet though b/c pyquery
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-python')
-rw-r--r-- | dev-python/webtest/files/webtest-3.0.0-python3.12-unittest.patch | 115 | ||||
-rw-r--r-- | dev-python/webtest/webtest-3.0.0-r1.ebuild | 4 |
2 files changed, 118 insertions, 1 deletions
diff --git a/dev-python/webtest/files/webtest-3.0.0-python3.12-unittest.patch b/dev-python/webtest/files/webtest-3.0.0-python3.12-unittest.patch new file mode 100644 index 000000000000..c797a8cbb0c9 --- /dev/null +++ b/dev-python/webtest/files/webtest-3.0.0-python3.12-unittest.patch @@ -0,0 +1,115 @@ +https://github.com/Pylons/webtest/pull/251 + +From d82ec5bd2cf3c7109a1d49ad9fa802ae1eae1763 Mon Sep 17 00:00:00 2001 +From: Sam James <sam@gentoo.org> +Date: Mon, 29 May 2023 15:54:28 +0100 +Subject: [PATCH] Replace deprecated unittest aliases for Python 3.12 + +See https://docs.python.org/3.12/whatsnew/3.12.html#removed. +--- a/tests/test_app.py ++++ b/tests/test_app.py +@@ -221,7 +221,7 @@ def cookie_app(environ, start_response): + ('Set-Cookie', 'foo=bar;baz'), + ]) + else: +- self.assertEquals(dict(req.cookies), ++ self.assertEqual(dict(req.cookies), + {'spam': 'eggs', 'foo': 'bar'}) + self.assertIn('foo=bar', environ['HTTP_COOKIE']) + self.assertIn('spam=eggs', environ['HTTP_COOKIE']) +@@ -258,7 +258,7 @@ def cookie_app(environ, start_response): + ('Set-Cookie', 'foo=bar;baz; secure'), + ]) + else: +- self.assertEquals(dict(req.cookies), ++ self.assertEqual(dict(req.cookies), + {'spam': 'eggs', 'foo': 'bar'}) + self.assertIn('foo=bar', environ['HTTP_COOKIE']) + self.assertIn('spam=eggs', environ['HTTP_COOKIE']) +--- a/tests/test_authorisation.py ++++ b/tests/test_authorisation.py +@@ -17,7 +17,7 @@ def test_basic_authorization(self): + app.authorization = authorization + + self.assertIn('HTTP_AUTHORIZATION', app.extra_environ) +- self.assertEquals(app.authorization, authorization) ++ self.assertEqual(app.authorization, authorization) + + resp = app.get('/') + resp.mustcontain('HTTP_AUTHORIZATION: Basic Z2F3ZWw6cGFzc3dk') +@@ -26,7 +26,7 @@ def test_basic_authorization(self): + authtype, value = header.split(' ') + auth = (authtype, + b64decode(to_bytes(value)).decode('latin1').split(':')) +- self.assertEquals(authorization, auth) ++ self.assertEqual(authorization, auth) + + app.authorization = None + self.assertNotIn('HTTP_AUTHORIZATION', app.extra_environ) +@@ -37,7 +37,7 @@ def test_bearer_authorization(self): + app.authorization = authorization + + self.assertIn('HTTP_AUTHORIZATION', app.extra_environ) +- self.assertEquals(app.authorization, authorization) ++ self.assertEqual(app.authorization, authorization) + + resp = app.get('/') + resp.mustcontain('HTTP_AUTHORIZATION: Bearer 2588409761fcfa3e378bff4fb766e2e2') +--- a/tests/test_forms.py ++++ b/tests/test_forms.py +@@ -1031,7 +1031,7 @@ def test_upload_invalid_content(self): + single_form.submit("button") + except ValueError: + e = sys.exc_info()[1] +- self.assertEquals( ++ self.assertEqual( + str(e), + u('File content must be %s not %s' % (bytes, int)) + ) +--- a/tests/test_lint.py ++++ b/tests/test_lint.py +@@ -62,15 +62,15 @@ class TestMiddleware(unittest.TestCase): + @unittest.skipIf(sys.flags.optimize > 0, "skip assert tests if optimize is enabled") + def test_lint_too_few_args(self): + linter = middleware(application) +- with self.assertRaisesRegexp(AssertionError, "Two arguments required"): ++ with self.assertRaisesRegex(AssertionError, "Two arguments required"): + linter() +- with self.assertRaisesRegexp(AssertionError, "Two arguments required"): ++ with self.assertRaisesRegex(AssertionError, "Two arguments required"): + linter({}) + + @unittest.skipIf(sys.flags.optimize > 0, "skip assert tests if optimize is enabled") + def test_lint_no_keyword_args(self): + linter = middleware(application) +- with self.assertRaisesRegexp(AssertionError, "No keyword arguments " ++ with self.assertRaisesRegex(AssertionError, "No keyword arguments " + "allowed"): + linter({}, 'foo', baz='baz') + +@@ -82,7 +82,7 @@ def test_lint_no_keyword_args(self): + def test_lint_iterator_returned(self): + linter = middleware(lambda x, y: None) # None is not an iterator + msg = "The application must return an iterator, if only an empty list" +- with self.assertRaisesRegexp(AssertionError, msg): ++ with self.assertRaisesRegex(AssertionError, msg): + linter({'wsgi.input': 'foo', 'wsgi.errors': 'foo'}, 'foo') + + +@@ -109,13 +109,13 @@ def test_close(self): + def test_iter(self): + data = to_bytes("A line\nAnother line\nA final line\n") + input_wrapper = InputWrapper(BytesIO(data)) +- self.assertEquals(to_bytes("").join(input_wrapper), data, '') ++ self.assertEqual(to_bytes("").join(input_wrapper), data, '') + + def test_seek(self): + data = to_bytes("A line\nAnother line\nA final line\n") + input_wrapper = InputWrapper(BytesIO(data)) + input_wrapper.seek(0) +- self.assertEquals(to_bytes("").join(input_wrapper), data, '') ++ self.assertEqual(to_bytes("").join(input_wrapper), data, '') + + + class TestMiddleware2(unittest.TestCase): + diff --git a/dev-python/webtest/webtest-3.0.0-r1.ebuild b/dev-python/webtest/webtest-3.0.0-r1.ebuild index 8e4a5a67c8eb..55be134cdd50 100644 --- a/dev-python/webtest/webtest-3.0.0-r1.ebuild +++ b/dev-python/webtest/webtest-3.0.0-r1.ebuild @@ -6,7 +6,8 @@ EAPI=8 DISTUTILS_USE_PEP517=setuptools PYPI_NO_NORMALIZE=1 PYPI_PN="WebTest" -PYTHON_COMPAT=( python3_{9..11} pypy3 ) +# py3.12 should pass but pyquery doesn't yet support 3.12 +PYTHON_COMPAT=( python3_{10..11} pypy3 ) inherit distutils-r1 pypi @@ -37,6 +38,7 @@ BDEPEND=" PATCHES=( "${FILESDIR}/webtest-2.0.33-no-pylons-theme.patch" + "${FILESDIR}/webtest-3.0.0-python3.12-unittest.patch" ) distutils_enable_sphinx docs |