summaryrefslogtreecommitdiff
path: root/user/py3-html5lib
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2020-01-13 05:05:43 +0000
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2020-01-13 05:05:43 +0000
commitf809d27d00677997adac74dc1422d8a42ec69b0c (patch)
treeaf404a9ba09eac3ec534a308260193454781879e /user/py3-html5lib
parent025606accdfe07de9aafe079e4f068ac4d54d9d1 (diff)
downloadpackages-f809d27d00677997adac74dc1422d8a42ec69b0c.tar.gz
packages-f809d27d00677997adac74dc1422d8a42ec69b0c.tar.bz2
packages-f809d27d00677997adac74dc1422d8a42ec69b0c.tar.xz
packages-f809d27d00677997adac74dc1422d8a42ec69b0c.zip
user/*: Modernise / fix syntax / deps / metadata / code
Diffstat (limited to 'user/py3-html5lib')
-rw-r--r--user/py3-html5lib/APKBUILD14
-rw-r--r--user/py3-html5lib/pytest.patch163
2 files changed, 170 insertions, 7 deletions
diff --git a/user/py3-html5lib/APKBUILD b/user/py3-html5lib/APKBUILD
index 898efe4f1..f4f5f7781 100644
--- a/user/py3-html5lib/APKBUILD
+++ b/user/py3-html5lib/APKBUILD
@@ -9,27 +9,27 @@ pkgrel=0
pkgdesc="HTML parser based on the WHATWG HTML specification"
url="https://pypi.python.org/pypi/html5lib"
arch="noarch"
+options="!check" # https://github.com/html5lib/html5lib-python/issues/433
license="MIT"
depends="python3 py3-six py3-webencodings"
-makedepends="python3-dev"
checkdepends="py3-pytest py3-mock py3-pytest-expect"
-source="$pkgname-$pkgver.tar.gz::https://files.pythonhosted.org/packages/source/$_p/$_pkgname/$_pkgname-$pkgver.tar.gz"
+makedepends="python3-dev"
+source="$pkgname-$pkgver.tar.gz::https://files.pythonhosted.org/packages/source/$_p/$_pkgname/$_pkgname-$pkgver.tar.gz
+ pytest.patch
+ "
builddir="$srcdir/$_pkgname-$pkgver"
build() {
- cd "$builddir"
python3 setup.py build
}
check() {
- cd "$builddir"
pytest
}
package() {
- cd "$builddir"
python3 setup.py install --prefix=/usr --root="$pkgdir"
-
}
-sha512sums="35939b4450893864da04e735ee5e0addacf1dd34bae6a6909c76572abf6bfded446a78a713dfde91c1485ba45867d7abeb6a45cf0545c16ea968707be7de5dd2 py3-html5lib-1.0.1.tar.gz"
+sha512sums="35939b4450893864da04e735ee5e0addacf1dd34bae6a6909c76572abf6bfded446a78a713dfde91c1485ba45867d7abeb6a45cf0545c16ea968707be7de5dd2 py3-html5lib-1.0.1.tar.gz
+89be46d5eb7b4a9ada22fa30576ae4f92d705b77988a47d52cbd876bf36240b461e7a0057c865a6b1798a3117343159ecbca43faf5316b446e5a80b8486a7e86 pytest.patch"
diff --git a/user/py3-html5lib/pytest.patch b/user/py3-html5lib/pytest.patch
new file mode 100644
index 000000000..fd6f99649
--- /dev/null
+++ b/user/py3-html5lib/pytest.patch
@@ -0,0 +1,163 @@
+From 2699544837e68b12f1740a7eb56882a0dc0a4008 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
+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 +-
+ 6 files changed, 16 insertions(+), 15 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,
+ "<img title=\"1\"/>foo &lt;bad&gt;bar&lt;/bad&gt; baz",
+ "<%s title='1'>foo <bad>bar</bad> baz</%s>" % (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,
+ "<br title=\"1\"/>foo &lt;bad&gt;bar&lt;/bad&gt; baz<br/>",
+ "<%s title='1'>foo <bad>bar</bad> baz</%s>" % (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 &lt;bad&gt;bar&lt;/bad&gt; baz" % tag_name,
+ "<%s title='1'>foo <bad>bar</bad> baz</%s>" % (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 &lt;bad&gt;bar&lt;/bad&gt; baz</%s>" % (tag_name, tag_name),
+ "<%s title='1'>foo <bad>bar</bad> baz</%s>" % (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,
+ "<p %s=\"%s\">foo &lt;bad&gt;bar&lt;/bad&gt; baz</p>" % (attribute_name, attribute_value),
+ "<p %s='%s'>foo <bad>bar</bad> baz</p>" % (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,
+ "<img src=\"%s:%s\">foo</a>" % (protocol, rest_of_uri),
+ """<img src="%s:%s">foo</a>""" % (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,
+ "<img src=\"%s:%s\">foo</a>" % (protocol, rest_of_uri),
+ """<img src="%s:%s">foo</a>""" % (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
+From 29bb168659da16f7c03ce635a8fbb4cdc2502667 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Mat=C4=9Bj=20Cepl?= <mcepl@cepl.eu>
+Date: Mon, 6 Jan 2020 10:55:49 +0100
+Subject: [PATCH] marks not mark
+
+---
+ html5lib/tests/test_stream.py | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/html5lib/tests/test_stream.py b/html5lib/tests/test_stream.py
+index a9b3ebbe..06663b8c 100644
+--- a/html5lib/tests/test_stream.py
++++ b/html5lib/tests/test_stream.py
+@@ -310,8 +310,8 @@ def test_invalid_codepoints(inp, num):
+ ("'\\uDFFF\\uDBFF'", 2),
+ pytest.param(
+ "'\\uDBFF\\uDFFF'", 2,
+- mark=pytest.mark.skipif(sys.maxunicode == 0xFFFF,
+- reason="narrow Python"))])
++ marks=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)