- 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
This commit is contained in:
Tomáš Chvátal 2020-05-29 09:19:42 +00:00 committed by Git OBS Bridge
parent 19af531418
commit 8db09d7c48
3 changed files with 71 additions and 1 deletions

63
pytest5.patch Normal file
View File

@ -0,0 +1,63 @@
From 3f10121d98ce8ca36b4b856275093dd189fdf1d2 Mon Sep 17 00:00:00 2001
From: Sam Sneddon <me@gsnedders.com>
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']

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri May 29 09:17:23 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>
- Add patch to fix run with pytest5:
* pytest5.patch
-------------------------------------------------------------------
Wed May 6 07:41:38 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>

View File

@ -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}