Closed dangitall closed 9 years ago
After reading over the docs again I came up with this workaround:
@pytest.fixture
def name():
return "default"
@given('there is an object')
@given(parsers.parse('there is an object named {name:s}'))
def obj(name):
return name
Which isn't too bad but it still seems like it would be nice if defaults were directly supported.
pytest-bdd is just a pytest plugin, in the end it doesn't do what pytest cannot do either, and there's no concept of defaults for fixtures in pytest so i like your second solution, and it's how we do it as well in paylogic test suite
I'd like to be able to write a step specification like this:
But if I do this then
name
always gets set to"default"
even if the second step definition is used. Is there another way to achieve something like this? Or can defaults be supported for step arguments?