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,