From 6e51503f96f87c81db081e0634de14673dc39969 Mon Sep 17 00:00:00 2001 From: Charalampos Stratakis Date: Wed, 1 Jul 2020 13:11:54 +0200 Subject: [PATCH] Update to 1.1 (#1849837) Use pytest 5 --- .gitignore | 1 + collections-abc.patch | 44 ------------- pytest4.patch | 140 ------------------------------------------ python-html5lib.spec | 18 +++--- sources | 2 +- 5 files changed, 11 insertions(+), 194 deletions(-) delete mode 100644 collections-abc.patch delete mode 100644 pytest4.patch diff --git a/.gitignore b/.gitignore index 4337e94..c90028f 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ /html5lib-0.999.tar.gz /0.999999999.tar.gz /html5lib-1.0.1.tar.gz +/html5lib-1.1.tar.gz diff --git a/collections-abc.patch b/collections-abc.patch deleted file mode 100644 index 4a7ff78..0000000 --- a/collections-abc.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 322a2d57bfdc52a9ce14bee93f9abb372cc08487 Mon Sep 17 00:00:00 2001 -From: 5j9 <5j9@users.noreply.github.com> -Date: Sun, 23 Sep 2018 11:32:46 +0330 -Subject: [PATCH] Try to import MutableMapping from collections.abc - -Note that collections.abc has been added in Python 3.3. - -Fixes #402 ---- - html5lib/_trie/_base.py | 5 ++++- - html5lib/treebuilders/dom.py | 5 ++++- - 2 files changed, 8 insertions(+), 2 deletions(-) - -diff --git a/html5lib/_trie/_base.py b/html5lib/_trie/_base.py -index a1158bbb..6b71975f 100644 ---- a/html5lib/_trie/_base.py -+++ b/html5lib/_trie/_base.py -@@ -1,6 +1,9 @@ - from __future__ import absolute_import, division, unicode_literals - --from collections import Mapping -+try: -+ from collections.abc import Mapping -+except ImportError: # Python 2.7 -+ from collections import Mapping - - - class Trie(Mapping): -diff --git a/html5lib/treebuilders/dom.py b/html5lib/treebuilders/dom.py -index dcfac220..d8b53004 100644 ---- a/html5lib/treebuilders/dom.py -+++ b/html5lib/treebuilders/dom.py -@@ -1,7 +1,10 @@ - from __future__ import absolute_import, division, unicode_literals - - --from collections import MutableMapping -+try: -+ from collections.abc import MutableMapping -+except ImportError: # Python 2.7 -+ from collections import MutableMapping - from xml.dom import minidom, Node - import weakref - diff --git a/pytest4.patch b/pytest4.patch deleted file mode 100644 index e69efea..0000000 --- a/pytest4.patch +++ /dev/null @@ -1,140 +0,0 @@ -From dd117cc62d961573e9867d79ae1c3461a42e6167 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] 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 9333286e..29bbb492 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/python-html5lib.spec b/python-html5lib.spec index eceba4f..049ac76 100644 --- a/python-html5lib.spec +++ b/python-html5lib.spec @@ -1,15 +1,12 @@ %global srcname html5lib Name: python-%{srcname} Summary: A python based HTML parser/tokenizer -Version: 1.0.1 -Release: 10%{?dist} +Version: 1.1 +Release: 1%{?dist} Epoch: 1 License: MIT URL: https://github.com/html5lib/html5lib-python Source0: %pypi_source -Patch0: %{url}/pull/403.patch#/collections-abc.patch -#{url}/pull/414.patch#/pytest4.patch (tox.ini hunk fails) -Patch1: pytest4.patch BuildArch: noarch @@ -27,14 +24,14 @@ BuildRequires: python3-setuptools # Test deps BuildRequires: python3dist(mock) -BuildRequires: python3dist(pytest) < 5 +BuildRequires: python3dist(pytest) BuildRequires: python3dist(pytest-expect) BuildRequires: python3dist(six) BuildRequires: python3dist(webencodings) # Optional test deps: BuildRequires: python3dist(chardet) -#BuildRequires: python3dist(genshi) -- https://bugzilla.redhat.com/show_bug.cgi?id=1817711 +BuildRequires: python3dist(genshi) BuildRequires: python3dist(lxml) %{?python_provide:%python_provide python3-%{srcname}} @@ -56,8 +53,7 @@ specification for maximum compatibility with major desktop web browsers. %check -# XXX figure out the failure in test_encoding -%{__python3} -m pytest -k "not test_encoding" +%pytest %files -n python3-%{srcname} @@ -68,6 +64,10 @@ specification for maximum compatibility with major desktop web browsers. %changelog +* Wed Jul 01 2020 Charalampos Stratakis - 1:1.1-1 +- Update to 1.1 (#1849837) +- Use pytest 5 + * Sat May 30 2020 Miro HronĨok - 1:1.0.1-10 - Use pytest 4 diff --git a/sources b/sources index b3c2d48..196f21c 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (html5lib-1.0.1.tar.gz) = 35939b4450893864da04e735ee5e0addacf1dd34bae6a6909c76572abf6bfded446a78a713dfde91c1485ba45867d7abeb6a45cf0545c16ea968707be7de5dd2 +SHA512 (html5lib-1.1.tar.gz) = af7c29591007fded99be6c38e3d0ae5a4ac32d71d26046a615918ae732cb1c1ecbf754f47ceca1a53726c3843f3ecea7af87a7362281b45ff3af495815818626