I am using fixtures to mock my requests.
I am also using @pytest.mark.parametrize()
to add arguments to my tests.
I can do this:
def test_format(mock_api):
I can do this:
@pytest.mark.parametrize(
"format",
[
("xxx"),
("yyy"),
],
)
def test_format(format):
but I can't do this:
@pytest.mark.parametrize(
"my_mock",
[
(mock_api),
(None),
],
)
def test_format(my_mock):
Does anyone know a workaround for this?
[UPDATE] here is my fixture:
@fixture(scope="function")
def mock_api(app):
app.test_client_class = build_test_client_class(
{
"Authorization": "XXX",
"X-API-KEY": "YYY",
}
)
with app.test_client() as client:
yield client