from pytest import fixture
@fixture
def env():
return {"key1": "value1", "key2": "value2"}
def do_work(env):
print("working")
def test_0(env):
do_work(env)
def test_1(env):
env["key1"] = "new_value1"
do_work(env)
def test_2(env):
env["key2"] = "new_value3"
do_work(env)
In example I have test_1 and test_2 that do the same do_work, but before calling it edit fixture. How can I use parametrization (or anything else) to avoid writing two tests?
I can't just use fixture parametrization as is because test_0 does not require parametrization.