Consider you have the following pytest pseudo-code:
@pytest.fixture
def path(self):
return os.path.join(...)
@pytest.fixture
def module_names(self, path):
return [......some list comprehension]
@pytest.mark.parametrize('module', module_names)
def test_foo(self, path, module):
.....
And I get error like:
python3.7/site-packages/_pytest/mark/structures.py:99: in _parse_parametrize_parameters
ParameterSet.extract_from(x, force_tuple=force_tuple) for x in argvalues
E TypeError: 'function' object is not iterable
However when changing code to hardcoded like:
@pytest.mark.parametrize('module', ['foo1'])
it works...
Any idea why?