Sync from SUSE:SLFO:Main python-pytest-lazy-fixture revision 8c8d097537d1de36ec2759ad90b4b90c
This commit is contained in:
parent
15d832b635
commit
762ba37e34
@ -1,3 +1,12 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon May 6 05:59:39 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
|
||||||
|
|
||||||
|
- Switch to autosetup and pyproject macros.
|
||||||
|
- Add numpy to BuildRequires, needed for the testsuite.
|
||||||
|
- No more greedy globs in %files.
|
||||||
|
- Add patch support-pytest-8.patch:
|
||||||
|
* Support pytest >= 8 changes.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Apr 21 12:31:46 UTC 2023 - Dirk Müller <dmueller@suse.com>
|
Fri Apr 21 12:31:46 UTC 2023 - Dirk Müller <dmueller@suse.com>
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package python-pytest-lazy-fixture
|
# spec file for package python-pytest-lazy-fixture
|
||||||
#
|
#
|
||||||
# Copyright (c) 2023 SUSE LLC
|
# Copyright (c) 2024 SUSE LLC
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@ -16,7 +16,6 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
|
||||||
%{?sle15_python_module_pythons}
|
%{?sle15_python_module_pythons}
|
||||||
Name: python-pytest-lazy-fixture
|
Name: python-pytest-lazy-fixture
|
||||||
Version: 0.6.3
|
Version: 0.6.3
|
||||||
@ -25,11 +24,16 @@ Summary: Helper to use fixtures in pytest.markparametrize
|
|||||||
License: MIT
|
License: MIT
|
||||||
URL: https://github.com/tvorog/pytest-lazy-fixture
|
URL: https://github.com/tvorog/pytest-lazy-fixture
|
||||||
Source: https://files.pythonhosted.org/packages/source/p/pytest-lazy-fixture/pytest-lazy-fixture-%{version}.tar.gz
|
Source: https://files.pythonhosted.org/packages/source/p/pytest-lazy-fixture/pytest-lazy-fixture-%{version}.tar.gz
|
||||||
BuildRequires: %{python_module pytest >= 3.2.5}
|
# PATCH-FIX-UPSTREAM (ish) Sourced from gh#TvoroG/pytest-lazy-fixture/issues/65
|
||||||
|
Patch0: support-pytest-8.patch
|
||||||
|
BuildRequires: %{python_module numpy}
|
||||||
|
BuildRequires: %{python_module pip}
|
||||||
|
BuildRequires: %{python_module pytest >= 8.0}
|
||||||
BuildRequires: %{python_module setuptools}
|
BuildRequires: %{python_module setuptools}
|
||||||
|
BuildRequires: %{python_module wheel}
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
BuildRequires: python-rpm-macros
|
BuildRequires: python-rpm-macros
|
||||||
Requires: python-pytest >= 3.2.5
|
Requires: python-pytest >= 8.0
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
%python_subpackages
|
%python_subpackages
|
||||||
|
|
||||||
@ -37,13 +41,13 @@ BuildArch: noarch
|
|||||||
Helper to use fixtures in pytest.mark.parametrize.
|
Helper to use fixtures in pytest.mark.parametrize.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n pytest-lazy-fixture-%{version}
|
%autosetup -p1 -n pytest-lazy-fixture-%{version}
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%python_build
|
%pyproject_wheel
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%python_install
|
%pyproject_install
|
||||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||||
|
|
||||||
%check
|
%check
|
||||||
@ -52,6 +56,8 @@ Helper to use fixtures in pytest.mark.parametrize.
|
|||||||
%files %{python_files}
|
%files %{python_files}
|
||||||
%license LICENSE
|
%license LICENSE
|
||||||
%doc README.rst
|
%doc README.rst
|
||||||
%{python_sitelib}/*
|
%{python_sitelib}/pytest_lazyfixture.py
|
||||||
|
%pycache_only %{python_sitelib}/__pycache__/pytest_lazyfixture*.pyc
|
||||||
|
%{python_sitelib}/pytest_lazy_fixture-%{version}.dist-info
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
66
support-pytest-8.patch
Normal file
66
support-pytest-8.patch
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
diff --git a/pytest_lazyfixture.py b/pytest_lazyfixture.py
|
||||||
|
index abf5db5..df83ce7 100644
|
||||||
|
--- a/pytest_lazyfixture.py
|
||||||
|
+++ b/pytest_lazyfixture.py
|
||||||
|
@@ -71,14 +71,13 @@ def pytest_make_parametrize_id(config, val, argname):
|
||||||
|
def pytest_generate_tests(metafunc):
|
||||||
|
yield
|
||||||
|
|
||||||
|
- normalize_metafunc_calls(metafunc, 'funcargs')
|
||||||
|
- normalize_metafunc_calls(metafunc, 'params')
|
||||||
|
+ normalize_metafunc_calls(metafunc)
|
||||||
|
|
||||||
|
|
||||||
|
-def normalize_metafunc_calls(metafunc, valtype, used_keys=None):
|
||||||
|
+def normalize_metafunc_calls(metafunc, used_keys=None):
|
||||||
|
newcalls = []
|
||||||
|
for callspec in metafunc._calls:
|
||||||
|
- calls = normalize_call(callspec, metafunc, valtype, used_keys)
|
||||||
|
+ calls = normalize_call(callspec, metafunc, used_keys)
|
||||||
|
newcalls.extend(calls)
|
||||||
|
metafunc._calls = newcalls
|
||||||
|
|
||||||
|
@@ -98,17 +97,21 @@ def copy_metafunc(metafunc):
|
||||||
|
return copied
|
||||||
|
|
||||||
|
|
||||||
|
-def normalize_call(callspec, metafunc, valtype, used_keys):
|
||||||
|
+def normalize_call(callspec, metafunc, used_keys):
|
||||||
|
fm = metafunc.config.pluginmanager.get_plugin('funcmanage')
|
||||||
|
|
||||||
|
used_keys = used_keys or set()
|
||||||
|
- valtype_keys = set(getattr(callspec, valtype).keys()) - used_keys
|
||||||
|
+ keys = set(callspec.params.keys()) - used_keys
|
||||||
|
+ print(used_keys, keys)
|
||||||
|
|
||||||
|
- for arg in valtype_keys:
|
||||||
|
- val = getattr(callspec, valtype)[arg]
|
||||||
|
+ for arg in keys:
|
||||||
|
+ val = callspec.params[arg]
|
||||||
|
if is_lazy_fixture(val):
|
||||||
|
try:
|
||||||
|
- _, fixturenames_closure, arg2fixturedefs = fm.getfixtureclosure([val.name], metafunc.definition.parent)
|
||||||
|
+ if pytest.version_tuple >= (8, 0, 0):
|
||||||
|
+ fixturenames_closure, arg2fixturedefs = fm.getfixtureclosure(metafunc.definition.parent, [val.name], {})
|
||||||
|
+ else:
|
||||||
|
+ _, fixturenames_closure, arg2fixturedefs = fm.getfixtureclosure([val.name], metafunc.definition.parent)
|
||||||
|
except ValueError:
|
||||||
|
# 3.6.0 <= pytest < 3.7.0; `FixtureManager.getfixtureclosure` returns 2 values
|
||||||
|
fixturenames_closure, arg2fixturedefs = fm.getfixtureclosure([val.name], metafunc.definition.parent)
|
||||||
|
@@ -117,14 +120,14 @@ def normalize_call(callspec, metafunc, valtype, used_keys):
|
||||||
|
fixturenames_closure, arg2fixturedefs = fm.getfixtureclosure([val.name], current_node)
|
||||||
|
|
||||||
|
extra_fixturenames = [fname for fname in fixturenames_closure
|
||||||
|
- if fname not in callspec.params and fname not in callspec.funcargs]
|
||||||
|
+ if fname not in callspec.params]# and fname not in callspec.funcargs]
|
||||||
|
|
||||||
|
newmetafunc = copy_metafunc(metafunc)
|
||||||
|
newmetafunc.fixturenames = extra_fixturenames
|
||||||
|
newmetafunc._arg2fixturedefs.update(arg2fixturedefs)
|
||||||
|
newmetafunc._calls = [callspec]
|
||||||
|
fm.pytest_generate_tests(newmetafunc)
|
||||||
|
- normalize_metafunc_calls(newmetafunc, valtype, used_keys | set([arg]))
|
||||||
|
+ normalize_metafunc_calls(newmetafunc, used_keys | set([arg]))
|
||||||
|
return newmetafunc._calls
|
||||||
|
|
||||||
|
used_keys.add(arg)
|
Loading…
x
Reference in New Issue
Block a user