diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-09-26 21:01:01 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-09-26 21:01:01 -0400 |
commit | ffafbd4b9657a4ee8bec57c0861414144f37bdc5 (patch) | |
tree | b7542a5a90d7d08fdd5b1f258ff8939d84cc1814 /lib/sqlalchemy/testing/plugin/pytestplugin.py | |
parent | 75a8fb56437e2ea8e058b0dca3c876dc62c481c2 (diff) | |
download | sqlalchemy-ffafbd4b9657a4ee8bec57c0861414144f37bdc5.tar.gz |
Support pytest 6.x
pytest has removed support for pytest.Class().collect()
and we need to use from_parent.
Change-Id: Ia5fed9b22e76c99f71489283acee207f996f52a4
Diffstat (limited to 'lib/sqlalchemy/testing/plugin/pytestplugin.py')
-rw-r--r-- | lib/sqlalchemy/testing/plugin/pytestplugin.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/sqlalchemy/testing/plugin/pytestplugin.py b/lib/sqlalchemy/testing/plugin/pytestplugin.py index ca3fbe4a8..a4ace4e24 100644 --- a/lib/sqlalchemy/testing/plugin/pytestplugin.py +++ b/lib/sqlalchemy/testing/plugin/pytestplugin.py @@ -208,13 +208,10 @@ def pytest_collection_modifyitems(session, config, items): 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 + # support pytest 5.4.0 and above pytest.Class.from_parent + ctor = getattr(pytest.Class, "from_parent", pytest.Class) + for inst in ctor( + name=sub_cls.__name__, parent=test_class.parent.parent ).collect(): for t in inst.collect(): per_cls_dict[t.name].append(t) |