From 8db09d7c489807bbe1e5c58a77e91b231045590027dc57b72a1b5cef6ba009a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Fri, 29 May 2020 09:19:42 +0000 Subject: [PATCH] - Add patch to fix run with pytest5: * pytest5.patch OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-html5lib?expand=0&rev=45 --- pytest5.patch | 63 +++++++++++++++++++++++++++++++++++++++++ python-html5lib.changes | 6 ++++ python-html5lib.spec | 3 +- 3 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 pytest5.patch diff --git a/pytest5.patch b/pytest5.patch new file mode 100644 index 0000000..fe18735 --- /dev/null +++ b/pytest5.patch @@ -0,0 +1,63 @@ +From 3f10121d98ce8ca36b4b856275093dd189fdf1d2 Mon Sep 17 00:00:00 2001 +From: Sam Sneddon +Date: Fri, 22 May 2020 20:37:19 +0100 +Subject: [PATCH] Update pytest + +--- + .pytest.expect | 4 +-- + html5lib/tests/tree_construction.py | 12 ++++----- + 3 files changed, 15 insertions(+), 42 deletions(-) + +diff --git a/html5lib/tests/tree_construction.py b/html5lib/tests/tree_construction.py +index 6112d11d..1ef6e725 100644 +--- a/html5lib/tests/tree_construction.py ++++ b/html5lib/tests/tree_construction.py +@@ -57,8 +57,6 @@ def _getParserTests(self, treeName, treeAPIs): + item.add_marker(pytest.mark.parser) + if namespaceHTMLElements: + item.add_marker(pytest.mark.namespaced) +- if treeAPIs is None: +- item.add_marker(pytest.mark.skipif(True, reason="Treebuilder not loaded")) + yield item + + def _getTreeWalkerTests(self, treeName, treeAPIs): +@@ -69,8 +67,6 @@ def _getTreeWalkerTests(self, treeName, treeAPIs): + treeAPIs) + item.add_marker(getattr(pytest.mark, treeName)) + item.add_marker(pytest.mark.treewalker) +- if treeAPIs is None: +- item.add_marker(pytest.mark.skipif(True, reason="Treebuilder not loaded")) + yield item + + +@@ -84,12 +80,14 @@ def convertTreeDump(data): + class ParserTest(pytest.Item): + def __init__(self, name, parent, test, treeClass, namespaceHTMLElements): + super(ParserTest, self).__init__(name, parent) +- self.obj = lambda: 1 # this is to hack around skipif needing a function! + self.test = test + self.treeClass = treeClass + self.namespaceHTMLElements = namespaceHTMLElements + + def runtest(self): ++ if self.treeClass is None: ++ pytest.skip("Treebuilder not loaded") ++ + p = html5parser.HTMLParser(tree=self.treeClass, + namespaceHTMLElements=self.namespaceHTMLElements) + +@@ -147,11 +145,13 @@ def repr_failure(self, excinfo): + class TreeWalkerTest(pytest.Item): + def __init__(self, name, parent, test, treeAPIs): + super(TreeWalkerTest, self).__init__(name, parent) +- self.obj = lambda: 1 # this is to hack around skipif needing a function! + self.test = test + self.treeAPIs = treeAPIs + + def runtest(self): ++ if self.treeAPIs is None: ++ pytest.skip("Treebuilder not loaded") ++ + p = html5parser.HTMLParser(tree=self.treeAPIs["builder"]) + + input = self.test['data'] diff --git a/python-html5lib.changes b/python-html5lib.changes index 238d1b8..187800c 100644 --- a/python-html5lib.changes +++ b/python-html5lib.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri May 29 09:17:23 UTC 2020 - Tomáš Chvátal + +- Add patch to fix run with pytest5: + * pytest5.patch + ------------------------------------------------------------------- Wed May 6 07:41:38 UTC 2020 - Tomáš Chvátal diff --git a/python-html5lib.spec b/python-html5lib.spec index 9f3e7ce..eb5a608 100644 --- a/python-html5lib.spec +++ b/python-html5lib.spec @@ -28,11 +28,12 @@ Source: https://files.pythonhosted.org/packages/source/h/html5lib/html5l # This patch makes testsuite pass with pytest4 Patch0: pytest4-mhroncok.patch Patch1: collections-abc.patch +Patch2: pytest5.patch BuildRequires: %{python_module Genshi} BuildRequires: %{python_module datrie} BuildRequires: %{python_module lxml} BuildRequires: %{python_module mock} -BuildRequires: %{python_module pytest < 5.0} +BuildRequires: %{python_module pytest >= 4.0} BuildRequires: %{python_module pytest-expect} BuildRequires: %{python_module setuptools >= 18.5} BuildRequires: %{python_module six >= 1.9}