public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-python/html5lib/, dev-python/html5lib/files/
@ 2017-03-28 19:05 Zac Medico
  0 siblings, 0 replies; 5+ messages in thread
From: Zac Medico @ 2017-03-28 19:05 UTC (permalink / raw
  To: gentoo-commits

commit:     b056103962b4ecff159549327f4b5219ebdfafaf
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 28 18:41:17 2017 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Mar 28 19:05:34 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b0561039

dev-python/html5lib: fix for python3.6 (bug 613656)

Package-Manager: Portage-2.3.5, Repoman-2.3.2

 ...html5lib-0.9999999-python3.6-sanitizer-re.patch | 50 ++++++++++++++++++++++
 ...9999-r1.ebuild => html5lib-0.9999999-r2.ebuild} |  1 +
 2 files changed, 51 insertions(+)

diff --git a/dev-python/html5lib/files/html5lib-0.9999999-python3.6-sanitizer-re.patch b/dev-python/html5lib/files/html5lib-0.9999999-python3.6-sanitizer-re.patch
new file mode 100644
index 00000000000..c64cbe1ab3f
--- /dev/null
+++ b/dev-python/html5lib/files/html5lib-0.9999999-python3.6-sanitizer-re.patch
@@ -0,0 +1,50 @@
+--- a/html5lib/sanitizer.py
++++ b/html5lib/sanitizer.py
+@@ -203,7 +203,7 @@
+             for attr in self.attr_val_is_uri:
+                 if attr not in attrs:
+                     continue
+-                val_unescaped = re.sub("[`\000-\040\177-\240\s]+", '',
++                val_unescaped = re.sub(r"[`\000-\040\177-\240\s]+", '',
+                                        unescape(attrs[attr])).lower()
+                 # remove replacement characters from unescaped characters
+                 val_unescaped = val_unescaped.replace("\ufffd", "")
+@@ -228,7 +228,7 @@
+                                          ' ',
+                                          unescape(attrs[attr]))
+             if (token["name"] in self.svg_allow_local_href and
+-                'xlink:href' in attrs and re.search('^\s*[^#\s].*',
++                'xlink:href' in attrs and re.search(r'^\s*[^#\s].*',
+                                                     attrs['xlink:href'])):
+                 del attrs['xlink:href']
+             if 'style' in attrs:
+@@ -257,16 +257,16 @@
+ 
+     def sanitize_css(self, style):
+         # disallow urls
+-        style = re.compile('url\s*\(\s*[^\s)]+?\s*\)\s*').sub(' ', style)
++        style = re.compile(r'url\s*\(\s*[^\s)]+?\s*\)\s*').sub(' ', style)
+ 
+         # gauntlet
+-        if not re.match("""^([:,;#%.\sa-zA-Z0-9!]|\w-\w|'[\s\w]+'|"[\s\w]+"|\([\d,\s]+\))*$""", style):
++        if not re.match(r"""^([:,;#%.\sa-zA-Z0-9!]|\w-\w|'[\s\w]+'|"[\s\w]+"|\([\d,\s]+\))*$""", style):
+             return ''
+-        if not re.match("^\s*([-\w]+\s*:[^:;]*(;\s*|$))*$", style):
++        if not re.match(r"^\s*([-\w]+\s*:[^:;]*(;\s*|$))*$", style):
+             return ''
+ 
+         clean = []
+-        for prop, value in re.findall("([-\w]+)\s*:\s*([^:;]*)", style):
++        for prop, value in re.findall(r"([-\w]+)\s*:\s*([^:;]*)", style):
+             if not value:
+                 continue
+             if prop.lower() in self.allowed_css_properties:
+@@ -275,7 +275,7 @@
+                                                 'padding']:
+                 for keyword in value.split():
+                     if keyword not in self.acceptable_css_keywords and \
+-                            not re.match("^(#[0-9a-f]+|rgb\(\d+%?,\d*%?,?\d*%?\)?|\d{0,2}\.?\d{0,2}(cm|em|ex|in|mm|pc|pt|px|%|,|\))?)$", keyword):
++                            not re.match(r"^(#[0-9a-f]+|rgb\(\d+%?,\d*%?,?\d*%?\)?|\d{0,2}\.?\d{0,2}(cm|em|ex|in|mm|pc|pt|px|%|,|\))?)$", keyword):
+                         break
+                 else:
+                     clean.append(prop + ': ' + value + ';')

diff --git a/dev-python/html5lib/html5lib-0.9999999-r1.ebuild b/dev-python/html5lib/html5lib-0.9999999-r2.ebuild
similarity index 94%
rename from dev-python/html5lib/html5lib-0.9999999-r1.ebuild
rename to dev-python/html5lib/html5lib-0.9999999-r2.ebuild
index 44163d3c076..5b23d984fc3 100644
--- a/dev-python/html5lib/html5lib-0.9999999-r1.ebuild
+++ b/dev-python/html5lib/html5lib-0.9999999-r2.ebuild
@@ -24,6 +24,7 @@ DEPEND="${RDEPEND}
 
 PATCHES=(
 	"${FILESDIR}"/${P}-lxml-3.5.0-backport.patch
+	"${FILESDIR}"/${P}-python3.6-sanitizer-re.patch
 )
 
 python_test() {


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-python/html5lib/, dev-python/html5lib/files/
@ 2018-01-04 20:35 Michał Górny
  0 siblings, 0 replies; 5+ messages in thread
From: Michał Górny @ 2018-01-04 20:35 UTC (permalink / raw
  To: gentoo-commits

commit:     9f660cebb2308bb021a128fdd699ea70ec383c6a
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Jan  4 20:03:07 2018 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Jan  4 20:34:53 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9f660ceb

dev-python/html5lib: Clean old up

 .../html5lib-0.9999999-lxml-3.5.0-backport.patch   | 117 ---------------------
 ...html5lib-0.9999999-python3.6-sanitizer-re.patch |  50 ---------
 dev-python/html5lib/html5lib-0.9999999-r2.ebuild   |  32 ------
 3 files changed, 199 deletions(-)

diff --git a/dev-python/html5lib/files/html5lib-0.9999999-lxml-3.5.0-backport.patch b/dev-python/html5lib/files/html5lib-0.9999999-lxml-3.5.0-backport.patch
deleted file mode 100644
index fecfab9a4fb..00000000000
--- a/dev-python/html5lib/files/html5lib-0.9999999-lxml-3.5.0-backport.patch
+++ /dev/null
@@ -1,117 +0,0 @@
-From 46046c0f7125911ff8205f09a7574573bb953105 Mon Sep 17 00:00:00 2001
-From: Geoffrey Sneddon <geoffers@gmail.com>
-Date: Mon, 23 Nov 2015 15:17:07 +0000
-Subject: [PATCH 1/3] Make lxml tree-builder coerce comments to work with lxml
- 3.5.
-
----
- html5lib/ihatexml.py                | 2 ++
- html5lib/treebuilders/etree_lxml.py | 2 +-
- 2 files changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/html5lib/ihatexml.py b/html5lib/ihatexml.py
-index 0fc7930..b5b2e98 100644
---- a/html5lib/ihatexml.py
-+++ b/html5lib/ihatexml.py
-@@ -225,6 +225,8 @@ def coerceComment(self, data):
-             while "--" in data:
-                 warnings.warn("Comments cannot contain adjacent dashes", DataLossWarning)
-                 data = data.replace("--", "- -")
-+            if data.endswith("-"):
-+                data += " "
-         return data
- 
-     def coerceCharacters(self, data):
-diff --git a/html5lib/treebuilders/etree_lxml.py b/html5lib/treebuilders/etree_lxml.py
-index 35d08ef..17007e3 100644
---- a/html5lib/treebuilders/etree_lxml.py
-+++ b/html5lib/treebuilders/etree_lxml.py
-@@ -189,7 +189,7 @@ class TreeBuilder(_base.TreeBuilder):
- 
-     def __init__(self, namespaceHTMLElements, fullTree=False):
-         builder = etree_builders.getETreeModule(etree, fullTree=fullTree)
--        infosetFilter = self.infosetFilter = ihatexml.InfosetFilter()
-+        infosetFilter = self.infosetFilter = ihatexml.InfosetFilter(preventDoubleDashComments=True)
-         self.namespaceHTMLElements = namespaceHTMLElements
- 
-         class Attributes(dict):
-
-From 1c22e1ce93dd4acc81a66cfa03cf9720fbd741c7 Mon Sep 17 00:00:00 2001
-From: Geoffrey Sneddon <geoffers@gmail.com>
-Date: Mon, 23 Nov 2015 15:35:21 +0000
-Subject: [PATCH 2/3] fixup! Make lxml tree-builder coerce comments to work
- with lxml 3.5.
-
----
- html5lib/ihatexml.py                | 1 +
- html5lib/treebuilders/etree_lxml.py | 7 ++++---
- 2 files changed, 5 insertions(+), 3 deletions(-)
-
-diff --git a/html5lib/ihatexml.py b/html5lib/ihatexml.py
-index b5b2e98..5a81a12 100644
---- a/html5lib/ihatexml.py
-+++ b/html5lib/ihatexml.py
-@@ -226,6 +226,7 @@ def coerceComment(self, data):
-                 warnings.warn("Comments cannot contain adjacent dashes", DataLossWarning)
-                 data = data.replace("--", "- -")
-             if data.endswith("-"):
-+                warnings.warn("Comments cannot contain end in a dash", DataLossWarning)
-                 data += " "
-         return data
- 
-diff --git a/html5lib/treebuilders/etree_lxml.py b/html5lib/treebuilders/etree_lxml.py
-index 17007e3..c6c981f 100644
---- a/html5lib/treebuilders/etree_lxml.py
-+++ b/html5lib/treebuilders/etree_lxml.py
-@@ -54,7 +54,7 @@ def _getChildNodes(self):
- def testSerializer(element):
-     rv = []
-     finalText = None
--    infosetFilter = ihatexml.InfosetFilter()
-+    infosetFilter = ihatexml.InfosetFilter(preventDoubleDashComments=True)
- 
-     def serializeElement(element, indent=0):
-         if not hasattr(element, "tag"):
-@@ -257,7 +257,7 @@ def _getData(self):
-             data = property(_getData, _setData)
- 
-         self.elementClass = Element
--        self.commentClass = builder.Comment
-+        self.commentClass = Comment
-         # self.fragmentClass = builder.DocumentFragment
-         _base.TreeBuilder.__init__(self, namespaceHTMLElements)
- 
-@@ -344,7 +344,8 @@ def insertRoot(self, token):
- 
-         # Append the initial comments:
-         for comment_token in self.initial_comments:
--            root.addprevious(etree.Comment(comment_token["data"]))
-+            comment = self.commentClass(comment_token["data"])
-+            root.addprevious(comment._element)
- 
-         # Create the root document and add the ElementTree to it
-         self.document = self.documentClass()
-
-From 235a6d7ac7e0a3e2b431766e051094c2d3110ba3 Mon Sep 17 00:00:00 2001
-From: Geoffrey Sneddon <geoffers@gmail.com>
-Date: Mon, 23 Nov 2015 15:42:12 +0000
-Subject: [PATCH 3/3] fixup! Make lxml tree-builder coerce comments to work
- with lxml 3.5.
-
----
- html5lib/ihatexml.py | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/html5lib/ihatexml.py b/html5lib/ihatexml.py
-index 5a81a12..5da5d93 100644
---- a/html5lib/ihatexml.py
-+++ b/html5lib/ihatexml.py
-@@ -226,7 +226,7 @@ def coerceComment(self, data):
-                 warnings.warn("Comments cannot contain adjacent dashes", DataLossWarning)
-                 data = data.replace("--", "- -")
-             if data.endswith("-"):
--                warnings.warn("Comments cannot contain end in a dash", DataLossWarning)
-+                warnings.warn("Comments cannot end in a dash", DataLossWarning)
-                 data += " "
-         return data
- 

diff --git a/dev-python/html5lib/files/html5lib-0.9999999-python3.6-sanitizer-re.patch b/dev-python/html5lib/files/html5lib-0.9999999-python3.6-sanitizer-re.patch
deleted file mode 100644
index 2fbef2ad0b9..00000000000
--- a/dev-python/html5lib/files/html5lib-0.9999999-python3.6-sanitizer-re.patch
+++ /dev/null
@@ -1,50 +0,0 @@
---- a/html5lib/sanitizer.py
-+++ b/html5lib/sanitizer.py
-@@ -203,7 +203,7 @@
-             for attr in self.attr_val_is_uri:
-                 if attr not in attrs:
-                     continue
--                val_unescaped = re.sub("[`\000-\040\177-\240\s]+", '',
-+                val_unescaped = re.sub("[`\x00-\x20\x7f-\xa0\\s]+", '',
-                                        unescape(attrs[attr])).lower()
-                 # remove replacement characters from unescaped characters
-                 val_unescaped = val_unescaped.replace("\ufffd", "")
-@@ -228,7 +228,7 @@
-                                          ' ',
-                                          unescape(attrs[attr]))
-             if (token["name"] in self.svg_allow_local_href and
--                'xlink:href' in attrs and re.search('^\s*[^#\s].*',
-+                'xlink:href' in attrs and re.search(r'^\s*[^#\s].*',
-                                                     attrs['xlink:href'])):
-                 del attrs['xlink:href']
-             if 'style' in attrs:
-@@ -257,16 +257,16 @@
- 
-     def sanitize_css(self, style):
-         # disallow urls
--        style = re.compile('url\s*\(\s*[^\s)]+?\s*\)\s*').sub(' ', style)
-+        style = re.compile(r'url\s*\(\s*[^\s)]+?\s*\)\s*').sub(' ', style)
- 
-         # gauntlet
--        if not re.match("""^([:,;#%.\sa-zA-Z0-9!]|\w-\w|'[\s\w]+'|"[\s\w]+"|\([\d,\s]+\))*$""", style):
-+        if not re.match(r"""^([:,;#%.\sa-zA-Z0-9!]|\w-\w|'[\s\w]+'|"[\s\w]+"|\([\d,\s]+\))*$""", style):
-             return ''
--        if not re.match("^\s*([-\w]+\s*:[^:;]*(;\s*|$))*$", style):
-+        if not re.match(r"^\s*([-\w]+\s*:[^:;]*(;\s*|$))*$", style):
-             return ''
- 
-         clean = []
--        for prop, value in re.findall("([-\w]+)\s*:\s*([^:;]*)", style):
-+        for prop, value in re.findall(r"([-\w]+)\s*:\s*([^:;]*)", style):
-             if not value:
-                 continue
-             if prop.lower() in self.allowed_css_properties:
-@@ -275,7 +275,7 @@
-                                                 'padding']:
-                 for keyword in value.split():
-                     if keyword not in self.acceptable_css_keywords and \
--                            not re.match("^(#[0-9a-f]+|rgb\(\d+%?,\d*%?,?\d*%?\)?|\d{0,2}\.?\d{0,2}(cm|em|ex|in|mm|pc|pt|px|%|,|\))?)$", keyword):
-+                            not re.match(r"^(#[0-9a-f]+|rgb\(\d+%?,\d*%?,?\d*%?\)?|\d{0,2}\.?\d{0,2}(cm|em|ex|in|mm|pc|pt|px|%|,|\))?)$", keyword):
-                         break
-                 else:
-                     clean.append(prop + ': ' + value + ';')

diff --git a/dev-python/html5lib/html5lib-0.9999999-r2.ebuild b/dev-python/html5lib/html5lib-0.9999999-r2.ebuild
deleted file mode 100644
index 5b23d984fc3..00000000000
--- a/dev-python/html5lib/html5lib-0.9999999-r2.ebuild
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-PYTHON_COMPAT=( python2_7 python3_{4,5,6} pypy pypy3 )
-PYTHON_REQ_USE="xml(+)"
-
-inherit distutils-r1
-
-DESCRIPTION="HTML parser based on the HTML5 specification"
-HOMEPAGE="https://github.com/html5lib/html5lib-python/ https://html5lib.readthedocs.org"
-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 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux"
-IUSE="test"
-
-RDEPEND="dev-python/six[${PYTHON_USEDEP}]"
-DEPEND="${RDEPEND}
-	dev-python/setuptools[${PYTHON_USEDEP}]
-	test? ( dev-python/nose[${PYTHON_USEDEP}] )"
-
-PATCHES=(
-	"${FILESDIR}"/${P}-lxml-3.5.0-backport.patch
-	"${FILESDIR}"/${P}-python3.6-sanitizer-re.patch
-)
-
-python_test() {
-	nosetests --verbosity=3 || die "Tests fail with ${EPYTHON}"
-}


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-python/html5lib/, dev-python/html5lib/files/
@ 2019-11-27  1:13 Patrick McLean
  0 siblings, 0 replies; 5+ messages in thread
From: Patrick McLean @ 2019-11-27  1:13 UTC (permalink / raw
  To: gentoo-commits

commit:     861fb47c4f3c853ba2aabc53b0b6acbbeb7ceeaa
Author:     Patrick McLean <patrick.mclean <AT> sony <DOT> com>
AuthorDate: Tue Nov 26 23:53:34 2019 +0000
Commit:     Patrick McLean <chutzpah <AT> gentoo <DOT> 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 <chutzpah <AT> 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?= <miro@hroncok.cz>
+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,
+                    "<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
+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?= <mcepl@cepl.eu>
+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,
+-                   "<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))
++                             "<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':
+             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))
++                             "<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:
+             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))
++                             "<%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:
+             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))
++                             "<%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))
+
+     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,
+-               "<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))
++                         "<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))
+
+     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,
+-               "<img src=\"%s:%s\">foo</a>" % (protocol, rest_of_uri),
+-               """<img src="%s:%s">foo</a>""" % (protocol, rest_of_uri))
++                         "<img src=\"%s:%s\">foo</a>" % (protocol, rest_of_uri),
++                         '<img src="%s:%s">foo</a>' % (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,
+-               "<img src=\"%s:%s\">foo</a>" % (protocol, rest_of_uri),
+-               """<img src="%s:%s">foo</a>""" % (protocol, rest_of_uri))
++                         "<img src=\"%s:%s\">foo</a>" % (protocol, rest_of_uri),
++                         '<img src="%s:%s">foo</a>' % (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?= <mcepl@cepl.eu>
+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}"
 }


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-python/html5lib/, dev-python/html5lib/files/
@ 2020-10-08 18:42 Michał Górny
  0 siblings, 0 replies; 5+ messages in thread
From: Michał Górny @ 2020-10-08 18:42 UTC (permalink / raw
  To: gentoo-commits

commit:     2df34ea62c58a482f2a85c25acfa8c58f52e9b51
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Oct  8 18:42:20 2020 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Oct  8 18:42:20 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2df34ea6

dev-python/html5lib: Remove old

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/html5lib/Manifest                       |   1 -
 .../files/html5lib-1.0.1-collections-abc.patch     |  44 ----
 .../html5lib-python-1.0.1-support-pytest4.patch    | 270 ---------------------
 dev-python/html5lib/html5lib-1.0.1-r2.ebuild       |  37 ---
 4 files changed, 352 deletions(-)

diff --git a/dev-python/html5lib/Manifest b/dev-python/html5lib/Manifest
index 03c605eb9e6..24a9ed5ed3c 100644
--- a/dev-python/html5lib/Manifest
+++ b/dev-python/html5lib/Manifest
@@ -1,2 +1 @@
-DIST html5lib-1.0.1.tar.gz 252959 BLAKE2B d2a9fa19d6a18b9e0c39f737a22ff4d5a6533734843f787c083f9497fd94788dad0e1e96478fe48b262c208370cf58e91ab94cc06a3e2757a40e936363cd3148 SHA512 35939b4450893864da04e735ee5e0addacf1dd34bae6a6909c76572abf6bfded446a78a713dfde91c1485ba45867d7abeb6a45cf0545c16ea968707be7de5dd2
 DIST html5lib-1.1.tar.gz 272215 BLAKE2B 11a4fc3fb84bf8bab4af5da1de30b0892a9eb454505716b3db391187053c9aac159b1c82ae787896592b8fc850363bba9313b9d7fc617150771c3bfa1aeadefb SHA512 af7c29591007fded99be6c38e3d0ae5a4ac32d71d26046a615918ae732cb1c1ecbf754f47ceca1a53726c3843f3ecea7af87a7362281b45ff3af495815818626

diff --git a/dev-python/html5lib/files/html5lib-1.0.1-collections-abc.patch b/dev-python/html5lib/files/html5lib-1.0.1-collections-abc.patch
deleted file mode 100644
index d5a9dcac299..00000000000
--- a/dev-python/html5lib/files/html5lib-1.0.1-collections-abc.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 4f9235752cea29c5a31721440578b430823a1e69 Mon Sep 17 00:00:00 2001
-From: 5j9 <5j9@users.noreply.github.com>
-Date: Mon, 1 Oct 2018 15:02:33 +0330
-Subject: [PATCH] Try to import MutableMapping from collections.abc (#403)
-
-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/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
deleted file mode 100644
index 98c9fb23fc7..00000000000
--- a/dev-python/html5lib/files/html5lib-python-1.0.1-support-pytest4.patch
+++ /dev/null
@@ -1,270 +0,0 @@
-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 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,
-                    "<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
-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?= <mcepl@cepl.eu>
-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,
--                   "<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))
-+                             "<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':
-             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))
-+                             "<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:
-             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))
-+                             "<%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:
-             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))
-+                             "<%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))
-
-     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,
--               "<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))
-+                         "<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))
-
-     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,
--               "<img src=\"%s:%s\">foo</a>" % (protocol, rest_of_uri),
--               """<img src="%s:%s">foo</a>""" % (protocol, rest_of_uri))
-+                         "<img src=\"%s:%s\">foo</a>" % (protocol, rest_of_uri),
-+                         '<img src="%s:%s">foo</a>' % (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,
--               "<img src=\"%s:%s\">foo</a>" % (protocol, rest_of_uri),
--               """<img src="%s:%s">foo</a>""" % (protocol, rest_of_uri))
-+                         "<img src=\"%s:%s\">foo</a>" % (protocol, rest_of_uri),
-+                         '<img src="%s:%s">foo</a>' % (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?= <mcepl@cepl.eu>
-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-r2.ebuild b/dev-python/html5lib/html5lib-1.0.1-r2.ebuild
deleted file mode 100644
index cb7387aff2c..00000000000
--- a/dev-python/html5lib/html5lib-1.0.1-r2.ebuild
+++ /dev/null
@@ -1,37 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{6,7,8,9} pypy3 )
-PYTHON_REQ_USE="xml(+)"
-
-inherit distutils-r1
-
-DESCRIPTION="HTML parser based on the HTML5 specification"
-HOMEPAGE="https://github.com/html5lib/html5lib-python/ https://html5lib.readthedocs.org"
-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"
-IUSE="test"
-RESTRICT+=" !test? ( test )"
-
-RDEPEND=">=dev-python/six-1.9[${PYTHON_USEDEP}]
-	dev-python/webencodings[${PYTHON_USEDEP}]"
-BDEPEND="
-	test? (
-		${RDEPEND}
-		dev-python/pytest-expect[${PYTHON_USEDEP}]
-		dev-python/mock[${PYTHON_USEDEP}]
-	)"
-
-PATCHES=(
-	# fix deprecated import
-	"${FILESDIR}/html5lib-1.0.1-collections-abc.patch"
-	# https://github.com/html5lib/html5lib-python/pull/429
-	"${FILESDIR}/html5lib-python-1.0.1-support-pytest4.patch"
-)
-
-distutils_enable_tests pytest


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-python/html5lib/, dev-python/html5lib/files/
@ 2021-05-07 11:58 Michał Górny
  0 siblings, 0 replies; 5+ messages in thread
From: Michał Górny @ 2021-05-07 11:58 UTC (permalink / raw
  To: gentoo-commits

commit:     02cc2601e80e203f3f840a26977543674a013555
Author:     Jakov Smolic <jakov.smolic <AT> sartura <DOT> hr>
AuthorDate: Thu May  6 23:56:09 2021 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri May  7 11:57:42 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=02cc2601

dev-python/html5lib: Port to python3.10, support pytest-6

Closes: https://bugs.gentoo.org/754144
Signed-off-by: Jakov Smolic <jakov.smolic <AT> sartura.hr>
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 .../html5lib/files/html5lib-1.1-pytest6.patch      | 153 +++++++++++++++++++++
 dev-python/html5lib/html5lib-1.1.ebuild            |   9 +-
 2 files changed, 158 insertions(+), 4 deletions(-)

diff --git a/dev-python/html5lib/files/html5lib-1.1-pytest6.patch b/dev-python/html5lib/files/html5lib-1.1-pytest6.patch
new file mode 100644
index 00000000000..a511b40abea
--- /dev/null
+++ b/dev-python/html5lib/files/html5lib-1.1-pytest6.patch
@@ -0,0 +1,153 @@
+# https://github.com/html5lib/html5lib-python/pull/506
+# https://bugs.gentoo.org/754144
+From e6bd99e8f2497194ffd0a06c6954ebb28d7526bb Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
+Date: Sat, 8 Aug 2020 13:39:22 +0200
+Subject: [PATCH] Use Node.from_parent() constructor to support pytest 6
+
+Add a wrapper not to break pytest 4 (needed for Python 2 support).
+
+    ============================= test session starts ==============================
+    platform linux -- Python 3.9.0b5, pytest-6.0.1, py-1.9.0, pluggy-0.13.1
+    rootdir: /builddir/build/BUILD/html5lib-1.1, configfile: pytest.ini
+    plugins: expect-1.1.0
+    collected 0 items / 1 error
+
+    ==================================== ERRORS ====================================
+    ________________________ ERROR collecting test session _________________________
+    /usr/lib/python3.9/site-packages/pluggy/hooks.py:286: in __call__
+        return self._hookexec(self, self.get_hookimpls(), kwargs)
+    /usr/lib/python3.9/site-packages/pluggy/manager.py:93: in _hookexec
+        return self._inner_hookexec(hook, methods, kwargs)
+    /usr/lib/python3.9/site-packages/pluggy/manager.py:84: in <lambda>
+        self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
+    html5lib/tests/conftest.py:105: in pytest_collect_file
+        return TokenizerFile(path, parent)
+    /usr/lib/python3.9/site-packages/_pytest/nodes.py:95: in __call__
+        warnings.warn(NODE_USE_FROM_PARENT.format(name=self.__name__), stacklevel=2)
+    E   pytest.PytestDeprecationWarning: Direct construction of TokenizerFile has been deprecated, please use TokenizerFile.from_parent.
+    E   See https://docs.pytest.org/en/stable/deprecations.html#node-construction-changed-to-node-from-parent for more details.
+
+Fixes https://github.com/html5lib/html5lib-python/issues/505
+---
+ html5lib/tests/conftest.py          | 15 ++++++++++++---
+ html5lib/tests/sanitizer.py         |  2 +-
+ html5lib/tests/tokenizer.py         | 10 +++++-----
+ html5lib/tests/tree_construction.py | 20 ++++++++++----------
+ requirements-test.txt               |  2 +-
+ 5 files changed, 29 insertions(+), 20 deletions(-)
+
+diff --git a/html5lib/tests/conftest.py b/html5lib/tests/conftest.py
+index dad167c5..fffeb50c 100644
+--- a/html5lib/tests/conftest.py
++++ b/html5lib/tests/conftest.py
+@@ -99,10 +99,19 @@ def pytest_collect_file(path, parent):
+ 
+     if _tree_construction in dir_and_parents:
+         if path.ext == ".dat":
+-            return TreeConstructionFile(path, parent)
++            return TreeConstructionFile.from_parent(parent, fspath=path)
+     elif _tokenizer in dir_and_parents:
+         if path.ext == ".test":
+-            return TokenizerFile(path, parent)
++            return TokenizerFile.from_parent(parent, fspath=path)
+     elif _sanitizer_testdata in dir_and_parents:
+         if path.ext == ".dat":
+-            return SanitizerFile(path, parent)
++            return SanitizerFile.from_parent(parent, fspath=path)
++
++
++# Tiny wrapper to allow .from_parent constructors on older pytest for PY27
++if not hasattr(pytest.Item.__base__, "from_parent"):
++    @classmethod
++    def from_parent(cls, parent, **kwargs):
++        return cls(parent=parent, **kwargs)
++
++    pytest.Item.__base__.from_parent = from_parent
+diff --git a/html5lib/tests/sanitizer.py b/html5lib/tests/sanitizer.py
+index bb483421..16e53868 100644
+--- a/html5lib/tests/sanitizer.py
++++ b/html5lib/tests/sanitizer.py
+@@ -13,7 +13,7 @@ def collect(self):
+         with codecs.open(str(self.fspath), "r", encoding="utf-8") as fp:
+             tests = json.load(fp)
+         for i, test in enumerate(tests):
+-            yield SanitizerTest(str(i), self, test=test)
++            yield SanitizerTest.from_parent(self, name=str(i), test=test)
+ 
+ 
+ class SanitizerTest(pytest.Item):
+diff --git a/html5lib/tests/tokenizer.py b/html5lib/tests/tokenizer.py
+index 47264cc3..cc9897a4 100644
+--- a/html5lib/tests/tokenizer.py
++++ b/html5lib/tests/tokenizer.py
+@@ -192,7 +192,7 @@ def collect(self):
+             tests = json.load(fp)
+         if 'tests' in tests:
+             for i, test in enumerate(tests['tests']):
+-                yield TokenizerTestCollector(str(i), self, testdata=test)
++                yield TokenizerTestCollector.from_parent(self, name=str(i), testdata=test)
+ 
+ 
+ class TokenizerTestCollector(pytest.Collector):
+@@ -207,10 +207,10 @@ def __init__(self, name, parent=None, config=None, session=None, testdata=None):
+     def collect(self):
+         for initialState in self.testdata["initialStates"]:
+             initialState = capitalize(initialState)
+-            item = TokenizerTest(initialState,
+-                                 self,
+-                                 self.testdata,
+-                                 initialState)
++            item = TokenizerTest.from_parent(self,
++                                             name=initialState,
++                                             test=self.testdata,
++                                             initialState=initialState)
+             if self.testdata["input"] is None:
+                 item.add_marker(pytest.mark.skipif(True, reason="Relies on lone surrogates"))
+             yield item
+diff --git a/html5lib/tests/tree_construction.py b/html5lib/tests/tree_construction.py
+index 1ef6e725..fb0657bf 100644
+--- a/html5lib/tests/tree_construction.py
++++ b/html5lib/tests/tree_construction.py
+@@ -26,7 +26,7 @@ class TreeConstructionFile(pytest.File):
+     def collect(self):
+         tests = TestData(str(self.fspath), "data")
+         for i, test in enumerate(tests):
+-            yield TreeConstructionTest(str(i), self, testdata=test)
++            yield TreeConstructionTest.from_parent(self, name=str(i), testdata=test)
+ 
+ 
+ class TreeConstructionTest(pytest.Collector):
+@@ -48,11 +48,11 @@ def _getParserTests(self, treeName, treeAPIs):
+                 nodeid = "%s::parser::namespaced" % treeName
+             else:
+                 nodeid = "%s::parser::void-namespace" % treeName
+-            item = ParserTest(nodeid,
+-                              self,
+-                              self.testdata,
+-                              treeAPIs["builder"] if treeAPIs is not None else None,
+-                              namespaceHTMLElements)
++            item = ParserTest.from_parent(self,
++                                          name=nodeid,
++                                          test=self.testdata,
++                                          treeClass=treeAPIs["builder"] if treeAPIs is not None else None,
++                                          namespaceHTMLElements=namespaceHTMLElements)
+             item.add_marker(getattr(pytest.mark, treeName))
+             item.add_marker(pytest.mark.parser)
+             if namespaceHTMLElements:
+@@ -61,10 +61,10 @@ def _getParserTests(self, treeName, treeAPIs):
+ 
+     def _getTreeWalkerTests(self, treeName, treeAPIs):
+         nodeid = "%s::treewalker" % treeName
+-        item = TreeWalkerTest(nodeid,
+-                              self,
+-                              self.testdata,
+-                              treeAPIs)
++        item = TreeWalkerTest.from_parent(self,
++                                          name=nodeid,
++                                          test=self.testdata,
++                                          treeAPIs=treeAPIs)
+         item.add_marker(getattr(pytest.mark, treeName))
+         item.add_marker(pytest.mark.treewalker)
+         yield item
+

diff --git a/dev-python/html5lib/html5lib-1.1.ebuild b/dev-python/html5lib/html5lib-1.1.ebuild
index 3dc621cb73c..3fddc154671 100644
--- a/dev-python/html5lib/html5lib-1.1.ebuild
+++ b/dev-python/html5lib/html5lib-1.1.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=7
 
-PYTHON_COMPAT=( python3_{7,8,9} pypy3 )
+PYTHON_COMPAT=( python3_{7..10} pypy3 )
 PYTHON_REQ_USE="xml(+)"
 
 inherit distutils-r1
@@ -15,14 +15,15 @@ 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 ~riscv ~s390 sparc x86 ~x64-macos"
-IUSE="test"
-RESTRICT+=" !test? ( test )"
+
+PATCHES=(
+	"${FILESDIR}"/${P}-pytest6.patch
+)
 
 RDEPEND=">=dev-python/six-1.9[${PYTHON_USEDEP}]
 	dev-python/webencodings[${PYTHON_USEDEP}]"
 BDEPEND="
 	test? (
-		${RDEPEND}
 		dev-python/pytest-expect[${PYTHON_USEDEP}]
 		dev-python/mock[${PYTHON_USEDEP}]
 	)"


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-05-07 11:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-07 11:58 [gentoo-commits] repo/gentoo:master commit in: dev-python/html5lib/, dev-python/html5lib/files/ Michał Górny
  -- strict thread matches above, loose matches on Subject: below --
2020-10-08 18:42 Michał Górny
2019-11-27  1:13 Patrick McLean
2018-01-04 20:35 Michał Górny
2017-03-28 19:05 Zac Medico

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox