Hello community,
here is the log from the commit of package python-pytest-lazy-fixture for
openSUSE:Factory checked in at 2019-11-06 14:06:35
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pytest-lazy-fixture (Old)
and /work/SRC/openSUSE:Factory/.python-pytest-lazy-fixture.new.2990 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pytest-lazy-fixture"
Wed Nov 6 14:06:35 2019 rev:2 rq:745442 version:0.6.1
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-pytest-lazy-fixture/python-pytest-lazy-fixture.changes
2019-03-26 22:31:35.885717720 +0100
+++
/work/SRC/openSUSE:Factory/.python-pytest-lazy-fixture.new.2990/python-pytest-lazy-fixture.changes
2019-11-06 14:06:38.660819842 +0100
@@ -1,0 +2,6 @@
+Tue Nov 5 10:54:53 UTC 2019 - Tomáš Chvátal <[email protected]>
+
+- Update to 0.6.1:
+ * minor fixes
+
+-------------------------------------------------------------------
Old:
----
pytest-lazy-fixture-0.5.2.tar.gz
New:
----
pytest-lazy-fixture-0.6.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-pytest-lazy-fixture.spec ++++++
--- /var/tmp/diff_new_pack.G3rAhf/_old 2019-11-06 14:06:39.712820944 +0100
+++ /var/tmp/diff_new_pack.G3rAhf/_new 2019-11-06 14:06:39.716820948 +0100
@@ -18,21 +18,18 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-pytest-lazy-fixture
-Version: 0.5.2
+Version: 0.6.1
Release: 0
Summary: Helper to use fixtures in pytest.markparametrize
License: MIT
-Group: Development/Languages/Python
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
+BuildRequires: %{python_module pytest >= 3.2.5}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
-Requires: python-pytest >= 2.9.2
+Requires: python-pytest >= 3.2.5
BuildArch: noarch
-# SECTION test requirements
-BuildRequires: %{python_module pytest >= 2.9.2}
-# /SECTION
%python_subpackages
%description
@@ -49,7 +46,7 @@
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
-%python_exec -m pytest
+%pytest
%files %{python_files}
%license LICENSE
++++++ pytest-lazy-fixture-0.5.2.tar.gz -> pytest-lazy-fixture-0.6.1.tar.gz
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-lazy-fixture-0.5.2/PKG-INFO
new/pytest-lazy-fixture-0.6.1/PKG-INFO
--- old/pytest-lazy-fixture-0.5.2/PKG-INFO 2019-03-16 20:10:32.000000000
+0100
+++ new/pytest-lazy-fixture-0.6.1/PKG-INFO 2019-10-14 17:48:28.000000000
+0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.2
Name: pytest-lazy-fixture
-Version: 0.5.2
+Version: 0.6.1
Summary: It helps to use fixtures in pytest.mark.parametrize
Home-page: https://github.com/tvorog/pytest-lazy-fixture
Author: Marsel Zaripov
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-lazy-fixture-0.5.2/pytest_lazy_fixture.egg-info/PKG-INFO
new/pytest-lazy-fixture-0.6.1/pytest_lazy_fixture.egg-info/PKG-INFO
--- old/pytest-lazy-fixture-0.5.2/pytest_lazy_fixture.egg-info/PKG-INFO
2019-03-16 20:10:32.000000000 +0100
+++ new/pytest-lazy-fixture-0.6.1/pytest_lazy_fixture.egg-info/PKG-INFO
2019-10-14 17:48:28.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.2
Name: pytest-lazy-fixture
-Version: 0.5.2
+Version: 0.6.1
Summary: It helps to use fixtures in pytest.mark.parametrize
Home-page: https://github.com/tvorog/pytest-lazy-fixture
Author: Marsel Zaripov
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-lazy-fixture-0.5.2/pytest_lazy_fixture.egg-info/requires.txt
new/pytest-lazy-fixture-0.6.1/pytest_lazy_fixture.egg-info/requires.txt
--- old/pytest-lazy-fixture-0.5.2/pytest_lazy_fixture.egg-info/requires.txt
2019-03-16 20:10:32.000000000 +0100
+++ new/pytest-lazy-fixture-0.6.1/pytest_lazy_fixture.egg-info/requires.txt
2019-10-14 17:48:28.000000000 +0200
@@ -1 +1 @@
-pytest>=2.9.2
+pytest>=3.2.5
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-lazy-fixture-0.5.2/pytest_lazyfixture.py
new/pytest-lazy-fixture-0.6.1/pytest_lazyfixture.py
--- old/pytest-lazy-fixture-0.5.2/pytest_lazyfixture.py 2019-01-10
06:42:33.000000000 +0100
+++ new/pytest-lazy-fixture-0.6.1/pytest_lazyfixture.py 2019-10-14
17:23:13.000000000 +0200
@@ -25,17 +25,16 @@
def fillfixtures(_fillfixtures):
def fill(request):
item = request._pyfuncitem
- fixturenames = item.fixturenames
- autousenames =
item.session._fixturemanager._getautousenames(item.nodeid)
-
- for fname in fixturenames:
- if fname not in item.funcargs and fname in autousenames:
- item.funcargs[fname] = request.getfixturevalue(fname)
+ fixturenames = getattr(item, "fixturenames", None)
+ if fixturenames is None:
+ fixturenames = request.fixturenames
if hasattr(item, 'callspec'):
for param, val in sorted_by_dependency(item.callspec.params,
fixturenames):
- if is_lazy_fixture(val):
+ if val is not None and is_lazy_fixture(val):
item.callspec.params[param] =
request.getfixturevalue(val.name)
+ elif param not in item.funcargs:
+ item.funcargs[param] = request.getfixturevalue(param)
_fillfixtures()
return fill
@@ -126,9 +125,9 @@
non_free_fm = defaultdict(list)
for key in _sorted_argnames(params, fixturenames):
- val = params[key]
+ val = params.get(key)
- if not is_lazy_fixture(val) or val.name not in params:
+ if key not in params or not is_lazy_fixture(val) or val.name not in
params:
free_fm.append(key)
else:
non_free_fm[val.name].append(key)
@@ -139,7 +138,7 @@
_tree_to_list(non_free_fm, free_key)
)
- return [(key, params[key]) for key in (free_fm + non_free_fm_list)]
+ return [(key, params.get(key)) for key in (free_fm + non_free_fm_list)]
def _sorted_argnames(params, fixturenames):
@@ -148,7 +147,7 @@
for name in fixturenames:
if name in argnames:
argnames.remove(name)
- yield name
+ yield name
if argnames:
for name in argnames:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-lazy-fixture-0.5.2/setup.cfg
new/pytest-lazy-fixture-0.6.1/setup.cfg
--- old/pytest-lazy-fixture-0.5.2/setup.cfg 2019-03-16 20:10:32.000000000
+0100
+++ new/pytest-lazy-fixture-0.6.1/setup.cfg 2019-10-14 17:48:28.000000000
+0200
@@ -1,6 +1,6 @@
[flake8]
max-line-length = 120
-ignore = F821
+ignore = F821 W503 W504
[egg_info]
tag_build =
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-lazy-fixture-0.5.2/setup.py
new/pytest-lazy-fixture-0.6.1/setup.py
--- old/pytest-lazy-fixture-0.5.2/setup.py 2019-03-16 20:06:41.000000000
+0100
+++ new/pytest-lazy-fixture-0.6.1/setup.py 2019-10-14 17:35:21.000000000
+0200
@@ -13,7 +13,7 @@
setup(
name='pytest-lazy-fixture',
- version='0.5.2',
+ version='0.6.1',
author='Marsel Zaripov',
author_email='[email protected]',
maintainer='Marsel Zaripov',
@@ -23,7 +23,7 @@
description='It helps to use fixtures in pytest.mark.parametrize',
long_description=read('README.rst'),
py_modules=['pytest_lazyfixture'],
- install_requires=['pytest>=2.9.2'],
+ install_requires=['pytest>=3.2.5'],
classifiers=[
'Development Status :: 4 - Beta',
'Framework :: Pytest',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-lazy-fixture-0.5.2/tests/test_lazyfixture.py
new/pytest-lazy-fixture-0.6.1/tests/test_lazyfixture.py
--- old/pytest-lazy-fixture-0.5.2/tests/test_lazyfixture.py 2019-01-05
16:20:34.000000000 +0100
+++ new/pytest-lazy-fixture-0.6.1/tests/test_lazyfixture.py 2019-10-14
17:26:09.000000000 +0200
@@ -2,6 +2,11 @@
import pytest
from pytest_lazyfixture import sorted_by_dependency, lazy_fixture,
_sorted_argnames
+try:
+ import numpy
+except ImportError:
+ numpy = None
+
def test_fixture_in_parametrize_with_params(testdir):
items = testdir.getitems("""
@@ -575,8 +580,8 @@
@pytest.mark.parametrize('params,fixturenames,expect_keys', [
- ({'b': 1, 'a': 0}, ['c', 'a', 'd', 'b'], ['a', 'b']),
- ({'b': 1, 'a': 0}, ['c', 'b'], ['b', 'a'])
+ ({'b': 1, 'a': 0}, ['c', 'a', 'd', 'b'], ['c', 'a', 'd', 'b']),
+ ({'b': 1, 'a': 0}, ['c', 'b'], ['c', 'b', 'a'])
])
def test_sorted_argnames(params, fixturenames, expect_keys):
assert list(_sorted_argnames(params, fixturenames)) == expect_keys
@@ -698,3 +703,178 @@
""")
reprec = testdir.inline_run('-s')
reprec.assertoutcome(passed=2)
+
+
+# https://github.com/TvoroG/pytest-lazy-fixture/issues/39
+def test_usefixture_runs_before_function_fixtures(testdir):
+ testdir.makepyfile("""
+ import pytest
+ from pytest_lazyfixture import lazy_fixture
+
+ invocation_order = []
+
+ @pytest.fixture
+ def module_fixture():
+ invocation_order.append('using module fixture')
+
+ @pytest.fixture
+ def fixture1():
+ invocation_order.append('using fixture1')
+ return 'fixture1'
+
+ @pytest.fixture
+ def fixture2():
+ invocation_order.append('using fixture2')
+ return 'fixture2'
+
+ @pytest.mark.usefixtures("module_fixture")
+ @pytest.mark.parametrize("fixt", [lazy_fixture("fixture1"),
lazy_fixture("fixture2")])
+ def test_test(fixt):
+ if fixt == 'fixture2':
+ print(' '.join(invocation_order))
+ """)
+ result = testdir.runpytest('-s')
+ stdout = result.stdout.str()
+ assert (
+ 'using module fixture using fixture1 using module fixture using
fixture2' in stdout
+ )
+
+
+# https://github.com/TvoroG/pytest-lazy-fixture/issues/39
+def
test_autouse_and_usefixture_module_scope_runs_before_function_fixtures(testdir):
+ testdir.makepyfile("""
+ import pytest
+ from pytest_lazyfixture import lazy_fixture
+
+ invocation_order = []
+
+ @pytest.fixture(autouse=True)
+ def autouse_fixture():
+ invocation_order.append('using autouse_fixture')
+
+ @pytest.fixture(scope='module')
+ def module_fixture():
+ invocation_order.append('using module fixture')
+
+ @pytest.fixture
+ def fixture1():
+ invocation_order.append('using fixture1')
+ return 'fixture1'
+
+ @pytest.fixture
+ def fixture2():
+ invocation_order.append('using fixture2')
+ return 'fixture2'
+
+ @pytest.mark.usefixtures("module_fixture")
+ @pytest.mark.parametrize("fixt", [lazy_fixture("fixture1"),
lazy_fixture("fixture2")])
+ def test_test(fixt):
+ if fixt == 'fixture2':
+ print(' '.join(invocation_order))
+ """)
+ result = testdir.runpytest('-s')
+ stdout = result.stdout.str()
+ assert (
+ # pytest==3.2.5
+ 'using autouse_fixture using module fixture using fixture1 using
autouse_fixture using fixture2' in stdout
+ or
+ 'using module fixture using autouse_fixture using fixture1 using
autouse_fixture using fixture2' in stdout
+ )
+
+
[email protected]('autouse_scope', [
+ 'session',
+ 'module',
+ pytest.param('function', marks=pytest.mark.xfail)
+])
+def
test_session_autouse_and_usefixture_module_scope_runs_before_function_fixtures(testdir,
autouse_scope):
+ testdir.makepyfile("""
+ import pytest
+ from pytest_lazyfixture import lazy_fixture
+
+ invocation_order = []
+
+ @pytest.fixture(autouse=True, scope='{autouse_scope}')
+ def autouse_fixture():
+ invocation_order.append('using autouse_fixture')
+
+ @pytest.fixture(scope='module')
+ def module_fixture():
+ invocation_order.append('using module fixture')
+
+ @pytest.fixture
+ def fixture1():
+ invocation_order.append("using fixture1")
+ return 'fixture1'
+
+ @pytest.fixture
+ def fixture2():
+ invocation_order.append("using fixture2")
+ return 'fixture2'
+
+ @pytest.mark.usefixtures("module_fixture")
+ @pytest.mark.parametrize("fixt", [lazy_fixture("fixture1"),
lazy_fixture("fixture2")])
+ def test_test(fixt):
+ if fixt == 'fixture2':
+ print(' '.join(invocation_order))
+ """.format(autouse_scope=autouse_scope))
+ result = testdir.runpytest('-s')
+ assert 'using autouse_fixture using module fixture using fixture1 using
fixture2' in result.stdout.str()
+
+
+# https://github.com/TvoroG/pytest-lazy-fixture/issues/39
+def test_module_scope_runs_before_function_fixtures(testdir):
+ testdir.makepyfile("""
+ import pytest
+ from pytest_lazyfixture import lazy_fixture
+
+ invocation_order = []
+
+ @pytest.fixture(scope='module')
+ def module_fixture():
+ invocation_order.append('using module fixture')
+
+ @pytest.fixture
+ def fixture1():
+ invocation_order.append("using fixture1")
+ return 'fixture1'
+
+ @pytest.fixture
+ def fixture2():
+ invocation_order.append("using fixture2")
+ return 'fixture2'
+
+ @pytest.mark.parametrize("fixt", [lazy_fixture("fixture1"),
lazy_fixture("fixture2")])
+ def test_test(fixt, module_fixture):
+ if fixt == 'fixture2':
+ print(' '.join(invocation_order))
+ """)
+ result = testdir.runpytest('-s')
+ stdout = result.stdout.str()
+ assert (
+ # pytest==3.2.5
+ 'using fixture1 using module fixture using fixture2' in stdout
+ or
+ 'using module fixture using fixture1 using fixture2' in stdout
+ )
+
+
+# https://github.com/TvoroG/pytest-lazy-fixture/issues/42
[email protected](numpy is None, reason='numpy is not installed')
+def test_numpy_array_as_value(testdir):
+ testdir.makepyfile("""
+ import pytest
+ import numpy as np
+
+ @pytest.mark.parametrize(
+ 'value',
+ [
+ np.arange(10, dtype=np.int64),
+ np.arange(10, dtype=np.int32),
+ ]
+ )
+ def test_bug(value):
+ assert isinstance(value, np.ndarray)
+ """)
+ result = testdir.inline_run('-s')
+ result.assertoutcome(passed=2)