From b7dfbb4cb1e82dff3511a46dbe2c587c3fc80062 Mon Sep 17 00:00:00 2001 From: baizg1107 Date: Tue, 12 Jan 2021 16:22:38 +0800 Subject: [PATCH] Fix building for pytest --- 0001-fix-build-for-pytest.patch | 46 +++++++++++++++++++++++++++++++++ python-sqlalchemy.spec | 6 ++++- 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 0001-fix-build-for-pytest.patch diff --git a/0001-fix-build-for-pytest.patch b/0001-fix-build-for-pytest.patch new file mode 100644 index 0000000..3b8b3c0 --- /dev/null +++ b/0001-fix-build-for-pytest.patch @@ -0,0 +1,46 @@ +From c9dc9e3bc42fa2342198017334a973bc1678f50d Mon Sep 17 00:00:00 2001 +From: baizg1107 +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 + diff --git a/python-sqlalchemy.spec b/python-sqlalchemy.spec index 9a2a54f..b0369e3 100644 --- a/python-sqlalchemy.spec +++ b/python-sqlalchemy.spec @@ -2,13 +2,14 @@ Name: python-sqlalchemy Version: 1.2.11 -Release: 4 +Release: 5 Summary: SQL toolkit and object relational mapper for Python License: MIT URL: http://www.sqlalchemy.org/ Source0: https://files.pythonhosted.org/packages/source/S/SQLAlchemy/SQLAlchemy-%{version}.tar.gz Patch0001: Skip-test-on-sqlite-3.30+.patch +Patch0002: 0001-fix-build-for-pytest.patch BuildRequires: python3-devel python3-setuptools python3-pytest @@ -64,6 +65,9 @@ PYTHONPATH=. %{__python3} -m pytest test %doc doc examples %changelog +* Tue Jan 12 2021 baizhonggui - 1.2.11-5 +- Fix building for pytest + * Mon Aug 10 2020 zhangjiapeng - 1.2.11-4 - Remove python2 -- Gitee