We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0408218 commit d78eaacCopy full SHA for d78eaac
tests/test_hooks.py
@@ -52,7 +52,12 @@ def test_item_collection_does_not_break_on_non_function_items(testdir):
52
53
@pytest.mark.tryfirst
54
def pytest_collection_modifyitems(session, config, items):
55
- items[:] = [CustomItem(name=item.name, parent=item.parent) for item in items]
+ try:
56
+ item_creator = CustomItem.from_parent # Only available in pytest >= 5.4.0
57
+ except AttributeError:
58
+ item_creator = CustomItem
59
+
60
+ items[:] = [item_creator(name=item.name, parent=item.parent) for item in items]
61
62
class CustomItem(pytest.Item):
63
def runtest(self):
0 commit comments