mirror of
https://github.com/sqlalchemy/sqlalchemy.git
synced 2026-05-06 08:56:51 -04:00
Support pytest 6.x
pytest has removed support for pytest.Class().collect() and we need to use from_parent. Change-Id: Ia5fed9b22e76c99f71489283acee207f996f52a4
This commit is contained in:
@@ -124,8 +124,9 @@ def pytest_collection_modifyitems(session, config, items):
|
||||
if sub_cls is not test_class.cls:
|
||||
list_ = rebuilt_items[test_class.cls]
|
||||
|
||||
for inst in pytest.Class(
|
||||
sub_cls.__name__,
|
||||
ctor = getattr(pytest.Class, "from_parent", pytest.Class)
|
||||
for inst in ctor(
|
||||
name=sub_cls.__name__,
|
||||
parent=test_class.parent.parent).collect():
|
||||
list_.extend(inst.collect())
|
||||
|
||||
@@ -148,7 +149,8 @@ def pytest_collection_modifyitems(session, config, items):
|
||||
|
||||
def pytest_pycollect_makeitem(collector, name, obj):
|
||||
if inspect.isclass(obj) and plugin_base.want_class(obj):
|
||||
return pytest.Class(name, parent=collector)
|
||||
ctor = getattr(pytest.Class, "from_parent", pytest.Class)
|
||||
return ctor(name=name, parent=collector)
|
||||
elif inspect.isfunction(obj) and \
|
||||
isinstance(collector, pytest.Instance) and \
|
||||
plugin_base.want_method(collector.cls, obj):
|
||||
|
||||
Reference in New Issue
Block a user