我有一个如下场景:
@pytest.fixture(scope="module", params=[5, 10])
def get_data(request):
data = []
for i in range(request.param):
data.append((i, 2))
return data
@pytest.mark.parametrize(('test_input','expected'), get_data)
def test_data_types(test_input, expected):
assert (test_input%expected) == 0
但我收到“TypeError:'function' object is not iterable”的错误。如何实现我的目标。我读到我们不能在参数化测试函数中使用夹具作为参数,但我想要一些替代方案。