From 0d6fd6dc04230d8a1269ca0d2e437b22ca3b7d06e6fd1954a5a0287c479a985f Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Fri, 9 Oct 2020 13:52:28 +0000 Subject: [PATCH] - Replace pytest_depr_from_parent.patch with the upstream commit resolving same issue (gh#sqlalchemy/sqlalchemy#commit40cdb9c0bf4d). OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-SQLAlchemy?expand=0&rev=175 --- pytest_depr_from_parent.patch | 71 ++++++++++++++++------------------- python-SQLAlchemy.changes | 6 +++ 2 files changed, 39 insertions(+), 38 deletions(-) diff --git a/pytest_depr_from_parent.patch b/pytest_depr_from_parent.patch index 8c9b30e..0565ded 100644 --- a/pytest_depr_from_parent.patch +++ b/pytest_depr_from_parent.patch @@ -1,6 +1,22 @@ +From 40cdb9c0bf4db2af293f9d8669257294d8fc69f9 Mon Sep 17 00:00:00 2001 +From: Mike Bayer +Date: Sat, 26 Sep 2020 21:01:01 -0400 +Subject: [PATCH] Support pytest 6.x + +pytest has removed support for pytest.Class().collect() +and we need to use from_parent. + +Change-Id: Ia5fed9b22e76c99f71489283acee207f996f52a4 +(cherry picked from commit ffafbd4b9657a4ee8bec57c0861414144f37bdc5) +--- + lib/sqlalchemy/testing/plugin/pytestplugin.py | 21 +++++++------------ + 1 file changed, 7 insertions(+), 14 deletions(-) + +diff --git a/lib/sqlalchemy/testing/plugin/pytestplugin.py b/lib/sqlalchemy/testing/plugin/pytestplugin.py +index 079066d829..ad4ebb6565 100644 --- a/lib/sqlalchemy/testing/plugin/pytestplugin.py +++ b/lib/sqlalchemy/testing/plugin/pytestplugin.py -@@ -162,16 +162,19 @@ def pytest_collection_modifyitems(sessio +@@ -162,13 +162,10 @@ def pytest_collection_modifyitems(session, config, items): if sub_cls is not test_class.cls: per_cls_dict = rebuilt_items[test_class.cls] @@ -11,50 +27,29 @@ - - for inst in pytest.Class( - sub_cls.__name__, parent=test_class.parent.parent -- ).collect(): -- for t in inst.collect(): -- per_cls_dict[t.name].append(t) -+ if hasattr(pytest.Class, "from_parent"): -+ # in pytest 5.4.0 -+ for inst in pytest.Class.from_parent( -+ test_class.parent.parent, name=sub_cls.__name__ -+ ).collect(): -+ for t in inst.collect(): -+ per_cls_dict[t.name].append(t) -+ else: -+ for inst in pytest.Class( -+ sub_cls.__name__, parent=test_class.parent.parent -+ ).collect(): -+ for t in inst.collect(): -+ per_cls_dict[t.name].append(t) ++ # 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) +@@ -196,15 +193,11 @@ def pytest_pycollect_makeitem(collector, name, obj): - newitems = [] - for item in items: -@@ -197,16 +200,17 @@ def pytest_pycollect_makeitem(collector, if inspect.isclass(obj) and plugin_base.want_class(name, obj): - # in pytest 5.4.0 +- # 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 [ ++ # support pytest 5.4.0 and above pytest.Class.from_parent ++ ctor = getattr(pytest.Class, "from_parent", pytest.Class) + + return [ - pytest.Class(parametrize_cls.__name__, parent=collector) -- for parametrize_cls in _parametrize_cls(collector.module, obj) -- ] -+ if hasattr(pytest.Class, "from_parent"): -+ return [ -+ pytest.Class.from_parent(collector, -+ name=parametrize_cls.__name__) -+ for parametrize_cls in _parametrize_cls(collector.module, obj) -+ ] -+ else: -+ return [ -+ pytest.Class(parametrize_cls.__name__, parent=collector) -+ for parametrize_cls in _parametrize_cls(collector.module, obj) -+ ] ++ ctor(name=parametrize_cls.__name__, parent=collector) + for parametrize_cls in _parametrize_cls(collector.module, obj) + ] elif ( - inspect.isfunction(obj) - and isinstance(collector, pytest.Instance) diff --git a/python-SQLAlchemy.changes b/python-SQLAlchemy.changes index 2b60a07..865e28d 100644 --- a/python-SQLAlchemy.changes +++ b/python-SQLAlchemy.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Oct 9 13:02:39 UTC 2020 - Matej Cepl + +- Replace pytest_depr_from_parent.patch with the upstream commit resolving + same issue (gh#sqlalchemy/sqlalchemy#commit40cdb9c0bf4d). + ------------------------------------------------------------------- Thu Oct 8 15:45:04 UTC 2020 - Matej Cepl