Skip to content

Commit c58167b

Browse files
committed
Fix deprecation warning
1 parent 34c78e5 commit c58167b

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

conftest.py

+4-7
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,10 @@ def pytest_collection_modifyitems(session, config, items):
106106
assert isinstance(item, _pytest.python.Function)
107107

108108
# unittest-style test functions have the node of UnitTest class as parent
109-
assert isinstance(
110-
item.parent,
111-
(
112-
_pytest.python.Class, # pytest >= 7.0.0
113-
_pytest.python.Instance, # pytest < 7.0.0
114-
),
115-
)
109+
if tuple(map(int, _pytest.__version__.split("."))) >= (7,):
110+
assert isinstance(item.parent, _pytest.python.Class)
111+
else:
112+
assert isinstance(item.parent, _pytest.python.Instance)
116113

117114
# and that node references the UnitTest class
118115
assert issubclass(item.parent.cls, _IrcTestCase)

0 commit comments

Comments
 (0)