Repository navigation
Open
Description
# -*- coding: utf-8 -*-
import string
import pytest
@pytest.fixture
def list_of_tuple_for_testing():
yield [(ord(x), x) for x in string.ascii_uppercase]
@pytest.mark.parametrize(
'chr_code, chr_object',
pytest.lazy_fixture('list_of_tuple_for_testing')
)
def test_all_files(chr_code, chr_object):
assert chr(chr_code) == chr_object================================================================================ ERRORS ================================================================================
________________________________________________________________ ERROR collecting test_lazy_fixture.py _________________________________________________________________
/usr/lib/python3.6/site-packages/pluggy/__init__.py:617: in __call__
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
/usr/lib/python3.6/site-packages/pluggy/__init__.py:222: in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
/usr/lib/python3.6/site-packages/pluggy/__init__.py:216: in <lambda>
firstresult=hook.spec_opts.get('firstresult'),
/usr/lib/python3.6/site-packages/_pytest/python.py:240: in pytest_pycollect_makeitem
res = list(collector._genfunctions(name, obj))
/usr/lib/python3.6/site-packages/_pytest/python.py:432: in _genfunctions
self.ihook.pytest_generate_tests(metafunc=metafunc)
/usr/lib/python3.6/site-packages/pluggy/__init__.py:617: in __call__
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
/usr/lib/python3.6/site-packages/pluggy/__init__.py:222: in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
/usr/lib/python3.6/site-packages/pluggy/__init__.py:216: in <lambda>
firstresult=hook.spec_opts.get('firstresult'),
/usr/lib/python3.6/site-packages/_pytest/python.py:161: in pytest_generate_tests
metafunc.parametrize(*marker.args, **marker.kwargs)
/usr/lib/python3.6/site-packages/_pytest/python.py:872: in parametrize
argnames, argvalues, self.function, self.config
/usr/lib/python3.6/site-packages/_pytest/mark/structures.py:106: in _for_parametrize
for x in argvalues
E TypeError: 'LazyFixture' object is not iterable
Reacted by skayres, Aleksandr Andreev, Parviz Khavari, jxramos, Tristan Nixon, hayden, Carlos Hernandez, Philipp Wiesner, Felix Ruess, Yinon178 and 10 more
Metadata
Metadata
Assignees
Labels
No labels
Activity
tnixon commentedon Jul 2, 2019
I've just run into a situation where this would be very useful to have!
(Code generates list of objects, I'd like to run a battery of tests on each - by passing the list to a parameterization)
davidstrouk commentedon May 20, 2021
Any news regarding this? I know this thread is old, but I have the exact same issue.
Ben621 commentedon Dec 13, 2021
Hey i have the same problem
Someone find a workaround @davidstrouk @tnixon ?