if sub_cls is not test_class.cls:
per_cls_dict = rebuilt_items[test_class.cls]
+ # in pytest 5.4.0
+ # for inst in pytest.Class.from_parent(
+ # test_class.parent.parent, name=sub_cls.__name__
+ # ).collect():
+
for inst in pytest.Class(
sub_cls.__name__, parent=test_class.parent.parent
).collect():
def pytest_pycollect_makeitem(collector, name, obj):
if inspect.isclass(obj) and plugin_base.want_class(name, obj):
+
+ # in pytest 5.4.0
+ # return [
+ # pytest.Class.from_parent(collector,
+ # name=parametrize_cls.__name__)
+ # for parametrize_cls in _parametrize_cls(collector.module, obj)
+ # ]
+
return [
pytest.Class(parametrize_cls.__name__, parent=collector)
for parametrize_cls in _parametrize_cls(collector.module, obj)
# ignore 2.0 warnings unless we are explicitly testing for them
warnings.filterwarnings("ignore", category=sa_exc.RemovedIn20Warning)
+ try:
+ import pytest
+ except ImportError:
+ pass
+ else:
+ warnings.filterwarnings(
+ "once", category=pytest.PytestDeprecationWarning
+ )
+
def assert_warnings(fn, warning_msgs, regex=False):
"""Assert that each of the given warnings are emitted by fn.