47 lines
1.8 KiB
Diff
47 lines
1.8 KiB
Diff
From c9dc9e3bc42fa2342198017334a973bc1678f50d Mon Sep 17 00:00:00 2001
|
|
From: baizg1107 <preloyalwhite@163.com>
|
|
Date: Tue, 12 Jan 2021 11:48:13 +0800
|
|
Subject: [PATCH] fix build for pytest
|
|
|
|
---
|
|
lib/sqlalchemy/testing/plugin/pytestplugin.py | 13 +++++++------
|
|
1 file changed, 7 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/lib/sqlalchemy/testing/plugin/pytestplugin.py b/lib/sqlalchemy/testing/plugin/pytestplugin.py
|
|
index da682ea..acb9145 100644
|
|
--- a/lib/sqlalchemy/testing/plugin/pytestplugin.py
|
|
+++ b/lib/sqlalchemy/testing/plugin/pytestplugin.py
|
|
@@ -123,10 +123,9 @@ def pytest_collection_modifyitems(session, config, items):
|
|
test_class.cls, test_class.parent.module):
|
|
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).collect():
|
|
+ for inst in pytest.Class.from_parent(
|
|
+ parent=test_class.parent.parent,
|
|
+ name=sub_cls.__name__).collect():
|
|
list_.extend(inst.collect())
|
|
|
|
newitems = []
|
|
@@ -148,11 +147,13 @@ 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)
|
|
+ item = pytest.Class.from_parent(parent=collector, name=name, obj=obj)
|
|
+ return item
|
|
elif inspect.isfunction(obj) and \
|
|
isinstance(collector, pytest.Instance) and \
|
|
plugin_base.want_method(collector.cls, obj):
|
|
- return pytest.Function(name, parent=collector)
|
|
+ item = pytest.Function.from_parent(parent=collector, name=name)
|
|
+ return item
|
|
else:
|
|
return []
|
|
|
|
--
|
|
2.23.0
|
|
|