]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Support pytest 6.x
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 27 Sep 2020 15:31:18 +0000 (11:31 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 27 Sep 2020 15:31:18 +0000 (11:31 -0400)
pytest has removed support for pytest.Class().collect()
and we need to use from_parent.

Change-Id: Ia5fed9b22e76c99f71489283acee207f996f52a4

lib/sqlalchemy/testing/plugin/pytestplugin.py

index c15a5c06201be00def26bfcdd84c3984a107974f..b8c22c34c2f875f6af897c46f0245ecfa76e9dc5 100644 (file)
@@ -143,8 +143,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__, parent=test_class.parent.parent
+                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())