Fix building for pytest

This commit is contained in:
baizg1107 2021-01-12 16:22:38 +08:00
parent 66b32eb0b5
commit b7dfbb4cb1
2 changed files with 51 additions and 1 deletions

View File

@ -0,0 +1,46 @@
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

View File

@ -2,13 +2,14 @@
Name: python-sqlalchemy Name: python-sqlalchemy
Version: 1.2.11 Version: 1.2.11
Release: 4 Release: 5
Summary: SQL toolkit and object relational mapper for Python Summary: SQL toolkit and object relational mapper for Python
License: MIT License: MIT
URL: http://www.sqlalchemy.org/ URL: http://www.sqlalchemy.org/
Source0: https://files.pythonhosted.org/packages/source/S/SQLAlchemy/SQLAlchemy-%{version}.tar.gz Source0: https://files.pythonhosted.org/packages/source/S/SQLAlchemy/SQLAlchemy-%{version}.tar.gz
Patch0001: Skip-test-on-sqlite-3.30+.patch Patch0001: Skip-test-on-sqlite-3.30+.patch
Patch0002: 0001-fix-build-for-pytest.patch
BuildRequires: python3-devel python3-setuptools python3-pytest BuildRequires: python3-devel python3-setuptools python3-pytest
@ -64,6 +65,9 @@ PYTHONPATH=. %{__python3} -m pytest test
%doc doc examples %doc doc examples
%changelog %changelog
* Tue Jan 12 2021 baizhonggui <baizhonggui@huawei.com> - 1.2.11-5
- Fix building for pytest
* Mon Aug 10 2020 zhangjiapeng <zhangjiapeng9@huawei.com> - 1.2.11-4 * Mon Aug 10 2020 zhangjiapeng <zhangjiapeng9@huawei.com> - 1.2.11-4
- Remove python2 - Remove python2