From 6b1084faced6cb3875af34db74c0e4c092e09319 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Fri, 4 Feb 2022 20:48:02 +0100 Subject: [PATCH] Add support for pytest 7.0.0 --- conftest.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/conftest.py b/conftest.py index 76ddde0..0939bcf 100644 --- a/conftest.py +++ b/conftest.py @@ -106,7 +106,13 @@ def pytest_collection_modifyitems(session, config, items): assert isinstance(item, _pytest.python.Function) # unittest-style test functions have the node of UnitTest class as parent - assert isinstance(item.parent, _pytest.python.Instance) + assert isinstance( + item.parent, + ( + _pytest.python.Class, # pytest >= 7.0.0 + _pytest.python.Instance, # pytest < 7.0.0 + ), + ) # and that node references the UnitTest class assert issubclass(item.parent.cls, _IrcTestCase)