From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 790DC138334 for ; Wed, 27 Nov 2019 01:13:50 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 9F1C3E0856; Wed, 27 Nov 2019 01:13:49 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 774F7E0856 for ; Wed, 27 Nov 2019 01:13:49 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id DA35B34D457 for ; Wed, 27 Nov 2019 01:13:47 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id BF0D88C5 for ; Wed, 27 Nov 2019 01:13:45 +0000 (UTC) From: "Patrick McLean" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Patrick McLean" Message-ID: <1574817217.861fb47c4f3c853ba2aabc53b0b6acbbeb7ceeaa.chutzpah@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/html5lib/, dev-python/html5lib/files/ X-VCS-Repository: repo/gentoo X-VCS-Files: dev-python/html5lib/files/html5lib-python-1.0.1-support-pytest4.patch dev-python/html5lib/html5lib-1.0.1-r1.ebuild dev-python/html5lib/html5lib-1.0.1.ebuild X-VCS-Directories: dev-python/html5lib/files/ dev-python/html5lib/ X-VCS-Committer: chutzpah X-VCS-Committer-Name: Patrick McLean X-VCS-Revision: 861fb47c4f3c853ba2aabc53b0b6acbbeb7ceeaa X-VCS-Branch: master Date: Wed, 27 Nov 2019 01:13:45 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: b580d73c-2adf-43a9-8e56-0c00a7470ec5 X-Archives-Hash: 45dd820861620c060caccbe41793e0bf commit: 861fb47c4f3c853ba2aabc53b0b6acbbeb7ceeaa Author: Patrick McLean sony com> AuthorDate: Tue Nov 26 23:53:34 2019 +0000 Commit: Patrick McLean gentoo org> CommitDate: Wed Nov 27 01:13:37 2019 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=861fb47c dev-python/html5lib: revbump, EAPI=7, py38 Copyright: Sony Interactive Entertainment Inc. Package-Manager: Portage-2.3.79, Repoman-2.3.18 Signed-off-by: Patrick McLean gentoo.org> .../html5lib-python-1.0.1-support-pytest4.patch | 270 +++++++++++++++++++++ ...l5lib-1.0.1.ebuild => html5lib-1.0.1-r1.ebuild} | 20 +- dev-python/html5lib/html5lib-1.0.1.ebuild | 2 + 3 files changed, 284 insertions(+), 8 deletions(-) diff --git a/dev-python/html5lib/files/html5lib-python-1.0.1-support-pytest4.patch b/dev-python/html5lib/files/html5lib-python-1.0.1-support-pytest4.patch new file mode 100644 index 00000000000..98c9fb23fc7 --- /dev/null +++ b/dev-python/html5lib/files/html5lib-python-1.0.1-support-pytest4.patch @@ -0,0 +1,270 @@ +From 2699544837e68b12f1740a7eb56882a0dc0a4008 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= +Date: Thu, 28 Mar 2019 01:45:43 +0100 +Subject: [PATCH 1/4] Support pytest 4 + +Fixes https://github.com/html5lib/html5lib-python/issues/411 +--- + html5lib/tests/test_encoding.py | 4 ++-- + html5lib/tests/test_sanitizer.py | 14 +++++++------- + html5lib/tests/test_serializer.py | 2 +- + html5lib/tests/test_stream.py | 7 ++++--- + html5lib/tests/test_treewalkers.py | 2 +- + requirements-test.txt | 2 +- + tox.ini | 2 +- + 7 files changed, 17 insertions(+), 16 deletions(-) + +diff --git a/html5lib/tests/test_encoding.py b/html5lib/tests/test_encoding.py +index 9a411c77..97b6ca2a 100644 +--- a/html5lib/tests/test_encoding.py ++++ b/html5lib/tests/test_encoding.py +@@ -99,8 +99,8 @@ def test_encoding(): + for filename in get_data_files("encoding"): + tests = _TestData(filename, b"data", encoding=None) + for test in tests: +- yield (runParserEncodingTest, test[b'data'], test[b'encoding']) +- yield (runPreScanEncodingTest, test[b'data'], test[b'encoding']) ++ runParserEncodingTest(test[b'data'], test[b'encoding']) ++ runPreScanEncodingTest(test[b'data'], test[b'encoding']) + + + # pylint:disable=wrong-import-position +diff --git a/html5lib/tests/test_sanitizer.py b/html5lib/tests/test_sanitizer.py +index 45046d57..1b7285fc 100644 +--- a/html5lib/tests/test_sanitizer.py ++++ b/html5lib/tests/test_sanitizer.py +@@ -67,19 +67,19 @@ def test_sanitizer(): + 'tfoot', 'th', 'thead', 'tr', 'select']: + continue # TODO + if tag_name == 'image': +- yield (runSanitizerTest, "test_should_allow_%s_tag" % tag_name, ++ runSanitizerTest("test_should_allow_%s_tag" % tag_name, + "foo <bad>bar</bad> baz", + "<%s title='1'>foo bar baz" % (tag_name, tag_name)) + elif tag_name == 'br': +- yield (runSanitizerTest, "test_should_allow_%s_tag" % tag_name, ++ runSanitizerTest("test_should_allow_%s_tag" % tag_name, + "
foo <bad>bar</bad> baz
", + "<%s title='1'>foo bar baz" % (tag_name, tag_name)) + elif tag_name in constants.voidElements: +- yield (runSanitizerTest, "test_should_allow_%s_tag" % tag_name, ++ runSanitizerTest("test_should_allow_%s_tag" % tag_name, + "<%s title=\"1\"/>foo <bad>bar</bad> baz" % tag_name, + "<%s title='1'>foo bar baz" % (tag_name, tag_name)) + else: +- yield (runSanitizerTest, "test_should_allow_%s_tag" % tag_name, ++ runSanitizerTest("test_should_allow_%s_tag" % tag_name, + "<%s title=\"1\">foo <bad>bar</bad> baz" % (tag_name, tag_name), + "<%s title='1'>foo bar baz" % (tag_name, tag_name)) + +@@ -93,7 +93,7 @@ def test_sanitizer(): + attribute_value = 'foo' + if attribute_name in sanitizer.attr_val_is_uri: + attribute_value = '%s://sub.domain.tld/path/object.ext' % sanitizer.allowed_protocols[0] +- yield (runSanitizerTest, "test_should_allow_%s_attribute" % attribute_name, ++ runSanitizerTest("test_should_allow_%s_attribute" % attribute_name, + "

foo <bad>bar</bad> baz

" % (attribute_name, attribute_value), + "

foo bar baz

" % (attribute_name, attribute_value)) + +@@ -101,7 +101,7 @@ def test_sanitizer(): + rest_of_uri = '//sub.domain.tld/path/object.ext' + if protocol == 'data': + rest_of_uri = 'image/png;base64,aGVsbG8gd29ybGQ=' +- yield (runSanitizerTest, "test_should_allow_uppercase_%s_uris" % protocol, ++ runSanitizerTest("test_should_allow_uppercase_%s_uris" % protocol, + "foo" % (protocol, rest_of_uri), + """foo""" % (protocol, rest_of_uri)) + +@@ -110,7 +110,7 @@ def test_sanitizer(): + if protocol == 'data': + rest_of_uri = 'image/png;base64,aGVsbG8gd29ybGQ=' + protocol = protocol.upper() +- yield (runSanitizerTest, "test_should_allow_uppercase_%s_uris" % protocol, ++ runSanitizerTest("test_should_allow_uppercase_%s_uris" % protocol, + "foo" % (protocol, rest_of_uri), + """foo""" % (protocol, rest_of_uri)) + +diff --git a/html5lib/tests/test_serializer.py b/html5lib/tests/test_serializer.py +index c23592af..a4250935 100644 +--- a/html5lib/tests/test_serializer.py ++++ b/html5lib/tests/test_serializer.py +@@ -222,4 +222,4 @@ def test_serializer(): + with open(filename) as fp: + tests = json.load(fp) + for test in tests['tests']: +- yield runSerializerTest, test["input"], test["expected"], test.get("options", {}) ++ runSerializerTest(test["input"], test["expected"], test.get("options", {})) +diff --git a/html5lib/tests/test_stream.py b/html5lib/tests/test_stream.py +index 27c39538..a9b3ebbe 100644 +--- a/html5lib/tests/test_stream.py ++++ b/html5lib/tests/test_stream.py +@@ -308,9 +308,10 @@ def test_invalid_codepoints(inp, num): + ("'\\uD800\\uD800\\uD800'", 3), + ("'a\\uD800a\\uD800a\\uD800a'", 3), + ("'\\uDFFF\\uDBFF'", 2), +- pytest.mark.skipif(sys.maxunicode == 0xFFFF, +- ("'\\uDBFF\\uDFFF'", 2), +- reason="narrow Python")]) ++ pytest.param( ++ "'\\uDBFF\\uDFFF'", 2, ++ mark=pytest.mark.skipif(sys.maxunicode == 0xFFFF, ++ reason="narrow Python"))]) + def test_invalid_codepoints_surrogates(inp, num): + inp = eval(inp) # pylint:disable=eval-used + fp = StringIO(inp) +diff --git a/html5lib/tests/test_treewalkers.py b/html5lib/tests/test_treewalkers.py +index 67fc89e5..c2323b7e 100644 +--- a/html5lib/tests/test_treewalkers.py ++++ b/html5lib/tests/test_treewalkers.py +@@ -99,7 +99,7 @@ def test_treewalker_six_mix(): + + for tree in sorted(treeTypes.items()): + for intext, attrs, expected in sm_tests: +- yield runTreewalkerEditTest, intext, expected, attrs, tree ++ runTreewalkerEditTest(intext, expected, attrs, tree) + + + @pytest.mark.parametrize("tree,char", itertools.product(sorted(treeTypes.items()), ["x", "\u1234"])) +diff --git a/requirements-test.txt b/requirements-test.txt +index 4e223a3f..b936e0fa 100644 +--- a/requirements-test.txt ++++ b/requirements-test.txt +@@ -4,7 +4,7 @@ tox + + flake8<3.0 + +-pytest==3.2.5 ++pytest>=4.3,<4.4 + coverage + pytest-expect>=1.1,<2.0 + mock +diff --git a/html5lib/tests/test_encoding.py b/html5lib/tests/test_encoding.py +index 97b6ca2a..9f137e7a 100644 +--- a/html5lib/tests/test_encoding.py ++++ b/html5lib/tests/test_encoding.py +@@ -95,6 +95,7 @@ def runPreScanEncodingTest(data, encoding): + assert encoding == stream.charEncoding[0].name, errorMessage(data, encoding, stream.charEncoding[0].name) + + ++@pytest.mark.skip(reason="broken under pytest4") + def test_encoding(): + for filename in get_data_files("encoding"): + tests = _TestData(filename, b"data", encoding=None) + +From 8ded69fdc0ae45f0531e1633927beb2190ab18a6 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Mat=C4=9Bj=20Cepl?= +Date: Fri, 8 Nov 2019 15:28:00 +0100 +Subject: [PATCH 3/4] Make flake8 happy + +--- + html5lib/tests/test_sanitizer.py | 44 ++++++++++++++++++++------------ + 1 file changed, 27 insertions(+), 17 deletions(-) + +diff --git a/html5lib/tests/test_sanitizer.py b/html5lib/tests/test_sanitizer.py +index 1b7285fc..a29d5ef3 100644 +--- a/html5lib/tests/test_sanitizer.py ++++ b/html5lib/tests/test_sanitizer.py +@@ -63,25 +63,32 @@ def test_sanitizer(): + for ns, tag_name in sanitizer.allowed_elements: + if ns != constants.namespaces["html"]: + continue +- if tag_name in ['caption', 'col', 'colgroup', 'optgroup', 'option', 'table', 'tbody', 'td', +- 'tfoot', 'th', 'thead', 'tr', 'select']: ++ if tag_name in ['caption', 'col', 'colgroup', 'optgroup', 'option', ++ 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', ++ 'tr', 'select']: + continue # TODO + if tag_name == 'image': + runSanitizerTest("test_should_allow_%s_tag" % tag_name, +- "foo <bad>bar</bad> baz", +- "<%s title='1'>foo bar baz" % (tag_name, tag_name)) ++ "foo <bad>bar</bad> baz", ++ "<%s title='1'>foo bar baz" % ++ (tag_name, tag_name)) + elif tag_name == 'br': + runSanitizerTest("test_should_allow_%s_tag" % tag_name, +- "
foo <bad>bar</bad> baz
", +- "<%s title='1'>foo bar baz" % (tag_name, tag_name)) ++ "
foo <bad>bar</bad> baz
", ++ "<%s title='1'>foo bar baz" % ++ (tag_name, tag_name)) + elif tag_name in constants.voidElements: + runSanitizerTest("test_should_allow_%s_tag" % tag_name, +- "<%s title=\"1\"/>foo <bad>bar</bad> baz" % tag_name, +- "<%s title='1'>foo bar baz" % (tag_name, tag_name)) ++ "<%s title=\"1\"/>foo <bad>bar</bad> baz" % ++ tag_name, ++ "<%s title='1'>foo bar baz" % ++ (tag_name, tag_name)) + else: + runSanitizerTest("test_should_allow_%s_tag" % tag_name, +- "<%s title=\"1\">foo <bad>bar</bad> baz" % (tag_name, tag_name), +- "<%s title='1'>foo bar baz" % (tag_name, tag_name)) ++ "<%s title=\"1\">foo <bad>bar</bad> baz" % ++ (tag_name, tag_name), ++ "<%s title='1'>foo bar baz" % ++ (tag_name, tag_name)) + + for ns, attribute_name in sanitizer.allowed_attributes: + if ns is not None: +@@ -92,18 +99,21 @@ def test_sanitizer(): + continue + attribute_value = 'foo' + if attribute_name in sanitizer.attr_val_is_uri: +- attribute_value = '%s://sub.domain.tld/path/object.ext' % sanitizer.allowed_protocols[0] ++ attribute_value = '%s://sub.domain.tld/path/object.ext' \ ++ % sanitizer.allowed_protocols[0] + runSanitizerTest("test_should_allow_%s_attribute" % attribute_name, +- "

foo <bad>bar</bad> baz

" % (attribute_name, attribute_value), +- "

foo bar baz

" % (attribute_name, attribute_value)) ++ "

foo <bad>bar</bad> baz

" % ++ (attribute_name, attribute_value), ++ "

foo bar baz

" % ++ (attribute_name, attribute_value)) + + for protocol in sanitizer.allowed_protocols: + rest_of_uri = '//sub.domain.tld/path/object.ext' + if protocol == 'data': + rest_of_uri = 'image/png;base64,aGVsbG8gd29ybGQ=' + runSanitizerTest("test_should_allow_uppercase_%s_uris" % protocol, +- "foo" % (protocol, rest_of_uri), +- """foo""" % (protocol, rest_of_uri)) ++ "foo" % (protocol, rest_of_uri), ++ 'foo' % (protocol, rest_of_uri)) + + for protocol in sanitizer.allowed_protocols: + rest_of_uri = '//sub.domain.tld/path/object.ext' +@@ -111,8 +121,8 @@ def test_sanitizer(): + rest_of_uri = 'image/png;base64,aGVsbG8gd29ybGQ=' + protocol = protocol.upper() + runSanitizerTest("test_should_allow_uppercase_%s_uris" % protocol, +- "foo" % (protocol, rest_of_uri), +- """foo""" % (protocol, rest_of_uri)) ++ "foo" % (protocol, rest_of_uri), ++ 'foo' % (protocol, rest_of_uri)) + + + def test_lowercase_color_codes_in_style(): + +From b4d066b2d9b4ea1135183c6500565c2ab8758bf1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Mat=C4=9Bj=20Cepl?= +Date: Fri, 8 Nov 2019 16:17:19 +0100 +Subject: [PATCH 4/4] No limits on the upper version of pytest + +--- + requirements-test.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/requirements-test.txt b/requirements-test.txt +index b936e0fa..1cd46922 100644 +--- a/requirements-test.txt ++++ b/requirements-test.txt +@@ -4,7 +4,7 @@ tox + + flake8<3.0 + +-pytest>=4.3,<4.4 ++pytest>=4.3 + coverage + pytest-expect>=1.1,<2.0 + mock diff --git a/dev-python/html5lib/html5lib-1.0.1.ebuild b/dev-python/html5lib/html5lib-1.0.1-r1.ebuild similarity index 63% copy from dev-python/html5lib/html5lib-1.0.1.ebuild copy to dev-python/html5lib/html5lib-1.0.1-r1.ebuild index e6da9bacdd2..751b9bc332d 100644 --- a/dev-python/html5lib/html5lib-1.0.1.ebuild +++ b/dev-python/html5lib/html5lib-1.0.1-r1.ebuild @@ -1,9 +1,9 @@ # Copyright 1999-2019 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -EAPI=6 +EAPI=7 -PYTHON_COMPAT=( python2_7 python3_{5,6,7} pypy pypy3 ) +PYTHON_COMPAT=( python{2_7,3_{5,6,7,8}} pypy{,3} ) PYTHON_REQ_USE="xml(+)" inherit distutils-r1 @@ -14,19 +14,23 @@ SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz" LICENSE="MIT" SLOT="0" -KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~mips ppc ppc64 s390 sparc x86 ~x64-macos" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~x64-macos" IUSE="test" RDEPEND=">=dev-python/six-1.9[${PYTHON_USEDEP}] dev-python/webencodings[${PYTHON_USEDEP}]" -DEPEND="${RDEPEND} +BDEPEND="${RDEPEND} dev-python/setuptools[${PYTHON_USEDEP}] test? ( - dev-python/pytest[${PYTHON_USEDEP}] dev-python/pytest-expect[${PYTHON_USEDEP}] dev-python/mock[${PYTHON_USEDEP}] )" -python_test() { - py.test -v || die "Tests fail with ${EPYTHON}" -} +RESTRICT+=" !test? ( test )" + +PATCHES=( + # https://github.com/html5lib/html5lib-python/pull/429 + "${FILESDIR}/html5lib-python-1.0.1-support-pytest4.patch" +) + +distutils_enable_tests pytest diff --git a/dev-python/html5lib/html5lib-1.0.1.ebuild b/dev-python/html5lib/html5lib-1.0.1.ebuild index e6da9bacdd2..c67285351b0 100644 --- a/dev-python/html5lib/html5lib-1.0.1.ebuild +++ b/dev-python/html5lib/html5lib-1.0.1.ebuild @@ -27,6 +27,8 @@ DEPEND="${RDEPEND} dev-python/mock[${PYTHON_USEDEP}] )" +RESTRICT="!test? ( test )" + python_test() { py.test -v || die "Tests fail with ${EPYTHON}" }