diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-09-27 11:33:26 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-09-27 11:33:26 -0400 |
commit | f0930898e0f26e2f2af169a9c6b446bf0095c1ff (patch) | |
tree | 9c677db613fda57afeffb59bae658168f5b7880a | |
parent | b30e9e26be424c978ad46f1538278fc26a972ea7 (diff) | |
download | sqlalchemy-rel_1_1.tar.gz |
Support pytest 6.xrel_1_1
pytest has removed support for pytest.Class().collect()
and we need to use from_parent.
Change-Id: Ia5fed9b22e76c99f71489283acee207f996f52a4
-rw-r--r-- | lib/sqlalchemy/testing/plugin/pytestplugin.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/sqlalchemy/testing/plugin/pytestplugin.py b/lib/sqlalchemy/testing/plugin/pytestplugin.py index 75064ada4..10a54351b 100644 --- a/lib/sqlalchemy/testing/plugin/pytestplugin.py +++ b/lib/sqlalchemy/testing/plugin/pytestplugin.py @@ -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): |