def test_override(request, overridable): """Test locally overriden fixture.""" # Test the fixture is also collected by the text name assert request.getfuncargvalue(get_step_fixture_name('I have locally overriden fixture', GIVEN))(request) == 'local' # 'I have the overriden fixture' stands for overridable and is overriden locally assert request.getfuncargvalue(get_step_fixture_name('I have the overriden fixture', GIVEN))(request) == 'local' assert overridable == 'local'
def test_when_then(request): """Test when and then tests are callable functions. This test checks that when and then are not evaluated during fixture collection that might break the scenario. """ do_stuff_ = request.getfuncargvalue(get_step_fixture_name('I do stuff', WHEN)) assert callable(do_stuff_) check_stuff_ = request.getfuncargvalue(get_step_fixture_name('I check stuff', THEN)) assert callable(check_stuff_)
def test_preserve_decorator(step, keyword): """Check that we preserve original function attributes after decorating it.""" @step(keyword) def func(): """Doc string.""" assert globals()[get_step_fixture_name(keyword, step.__name__)].__doc__ == 'Doc string.'
def test_global_when_step(request): """Test when step defined in the parent conftest.""" request.getfuncargvalue(get_step_fixture_name('I use a when step from the parent conftest', WHEN))