- Add pytest_depr_from_parent.patch to fix FTBGS with pytest 6.*
(gh#sqlalchemy/sqlalchemy#5635) OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-SQLAlchemy?expand=0&rev=174
This commit is contained in:
60
pytest_depr_from_parent.patch
Normal file
60
pytest_depr_from_parent.patch
Normal file
@@ -0,0 +1,60 @@
|
||||
--- a/lib/sqlalchemy/testing/plugin/pytestplugin.py
|
||||
+++ b/lib/sqlalchemy/testing/plugin/pytestplugin.py
|
||||
@@ -162,16 +162,19 @@ def pytest_collection_modifyitems(sessio
|
||||
if sub_cls is not test_class.cls:
|
||||
per_cls_dict = rebuilt_items[test_class.cls]
|
||||
|
||||
- # in pytest 5.4.0
|
||||
- # for inst in pytest.Class.from_parent(
|
||||
- # test_class.parent.parent, name=sub_cls.__name__
|
||||
- # ).collect():
|
||||
-
|
||||
- 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)
|
||||
|
||||
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
|
||||
- # return [
|
||||
- # pytest.Class.from_parent(collector,
|
||||
- # name=parametrize_cls.__name__)
|
||||
- # for parametrize_cls in _parametrize_cls(collector.module, obj)
|
||||
- # ]
|
||||
-
|
||||
- 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)
|
||||
+ ]
|
||||
elif (
|
||||
inspect.isfunction(obj)
|
||||
and isinstance(collector, pytest.Instance)
|
||||
@@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Oct 8 15:45:04 UTC 2020 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
- Add pytest_depr_from_parent.patch to fix FTBGS with pytest 6.*
|
||||
(gh#sqlalchemy/sqlalchemy#5635)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Aug 20 12:00:42 UTC 2020 - Ondřej Súkup <mimi.vx@gmail.com>
|
||||
|
||||
|
||||
@@ -25,6 +25,9 @@ Summary: Database Abstraction Library
|
||||
License: MIT
|
||||
URL: https://www.sqlalchemy.org
|
||||
Source: https://files.pythonhosted.org/packages/source/S/SQLAlchemy/SQLAlchemy-%{version}.tar.gz
|
||||
# PATCH-FIX-UPSTREAM pytest_depr_from_parent.patch gh#sqlalchemy/sqlalchemy#5635 mcepl@suse.com
|
||||
# pytest >= 3.4.0 requires Class.from_parent call
|
||||
Patch0: pytest_depr_from_parent.patch
|
||||
# devel is needed for optional C extensions cprocessors.so, cresultproxy.so and cutils.so
|
||||
BuildRequires: %{python_module devel}
|
||||
BuildRequires: %{python_module setuptools}
|
||||
@@ -65,6 +68,8 @@ reference for python-SQLAlchemy.
|
||||
|
||||
%prep
|
||||
%setup -q -n SQLAlchemy-%{version}
|
||||
%autopatch -p1
|
||||
|
||||
rm -rf doc/build # Remove unnecessary scripts for building documentation
|
||||
sed -i 's/\r$//' examples/dynamic_dict/dynamic_dict.py
|
||||
|
||||
@@ -77,7 +82,7 @@ export CFLAGS="%{optflags} -fno-strict-aliasing"
|
||||
%python_expand %fdupes %{buildroot}%{$python_sitearch}
|
||||
|
||||
%check
|
||||
%pytest -n auto
|
||||
%pytest_arch -n auto
|
||||
|
||||
%files %{python_files}
|
||||
%license LICENSE
|
||||
|
||||
Reference in New Issue
Block a user