I am learning about parameterized tests with pyest. After following the relevant pytest documentation, I came up with this simple example:
import unittest
import pytest
@pytest.fixture(autouse=True, params=['foo', 'bar'])
def foo(request):
print('fixture')
print(request.param)
class Foo(unittest.TestCase):
def setUp(self):
print('unittest setUp()')
def test(self):
print('test')
This gives the following error:
Failed: The requested fixture has no parameter defined for the current test.
E
E Requested fixture 'foo' defined in:
E tests/fixture.py:7
Line 7 is def foo(request):
.
What causes this error and how do I fix it?