From 6bcbf1cdaf228fac48ac632c2ff5cd91353191f3 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 9 Jan 2024 22:17:29 +0100 Subject: [PATCH] pytest_ver = pytest.getattr("version_tuple", ()) --- html5lib/tests/tokenizer.py | 3 ++- html5lib/tests/tree_construction.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/html5lib/tests/tokenizer.py b/html5lib/tests/tokenizer.py index add77b4c..8a4cf354 100644 --- a/html5lib/tests/tokenizer.py +++ b/html5lib/tests/tokenizer.py @@ -246,7 +246,8 @@ def runtest(self): def repr_failure(self, excinfo): traceback = excinfo.traceback ntraceback = traceback.cut(path=__file__) - filter_args = (excinfo,) if pytest.version_tuple >= (7, 4, 0) else () + pytest_ver = pytest.getattr("version_tuple", ()) + filter_args = (excinfo,) if pytest_ver >= (7, 4, 0) else () excinfo.traceback = ntraceback.filter(*filter_args) return excinfo.getrepr(funcargs=True, diff --git a/html5lib/tests/tree_construction.py b/html5lib/tests/tree_construction.py index 589f39a3..39ff1568 100644 --- a/html5lib/tests/tree_construction.py +++ b/html5lib/tests/tree_construction.py @@ -135,7 +135,8 @@ def runtest(self): def repr_failure(self, excinfo): traceback = excinfo.traceback ntraceback = traceback.cut(path=__file__) - filter_args = (excinfo,) if pytest.version_tuple >= (7, 4, 0) else () + pytest_ver = pytest.getattr("version_tuple", ()) + filter_args = (excinfo,) if pytest_ver >= (7, 4, 0) else () excinfo.traceback = ntraceback.filter(*filter_args) return excinfo.getrepr(funcargs=True,