Fix compatibility with pytest 7.4.0

This commit is contained in:
Lumir Balhar 2023-08-09 11:58:26 +02:00
parent d9c748e13f
commit b52016abf9
2 changed files with 51 additions and 0 deletions

49
573.patch Normal file
View File

@ -0,0 +1,49 @@
From 46c9caf733ea16f272ad2f131de9e78e2280d0ca Mon Sep 17 00:00:00 2001
From: Lumir Balhar <lbalhar@redhat.com>
Date: Wed, 9 Aug 2023 11:55:53 +0200
Subject: [PATCH] Fix compatibility with pytest 7.4.0
Fixes: https://github.com/html5lib/html5lib-python/issues/572
---
html5lib/tests/tokenizer.py | 8 +++++++-
html5lib/tests/tree_construction.py | 8 +++++++-
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/html5lib/tests/tokenizer.py b/html5lib/tests/tokenizer.py
index cc9897a4..8c4b1629 100644
--- a/html5lib/tests/tokenizer.py
+++ b/html5lib/tests/tokenizer.py
@@ -246,7 +246,13 @@ def runtest(self):
def repr_failure(self, excinfo):
traceback = excinfo.traceback
ntraceback = traceback.cut(path=__file__)
- excinfo.traceback = ntraceback.filter()
+
+ if pytest.version_tuple >= (7, 4, 0):
+ filter_args = (excinfo,)
+ else:
+ filter_args = ()
+
+ excinfo.traceback = ntraceback.filter(*filter_args)
return excinfo.getrepr(funcargs=True,
showlocals=False,
diff --git a/html5lib/tests/tree_construction.py b/html5lib/tests/tree_construction.py
index fb0657bf..c7c91bec 100644
--- a/html5lib/tests/tree_construction.py
+++ b/html5lib/tests/tree_construction.py
@@ -135,7 +135,13 @@ def runtest(self):
def repr_failure(self, excinfo):
traceback = excinfo.traceback
ntraceback = traceback.cut(path=__file__)
- excinfo.traceback = ntraceback.filter()
+
+ if pytest.version_tuple >= (7, 4, 0):
+ filter_args = (excinfo,)
+ else:
+ filter_args = ()
+
+ excinfo.traceback = ntraceback.filter(*filter_args)
return excinfo.getrepr(funcargs=True,
showlocals=False,

View File

@ -9,6 +9,8 @@ Source: %{pypi_source html5lib}
# Fix compatibility with pytest 6
Patch: %{url}/pull/506.patch
# Fix compatibility with pytest 7.4.0
Patch: %{url}/pull/573.patch
BuildArch: noarch