def test_when_then(request): """Test when and then steps are callable functions. This test checks that when and then are not evaluated during fixture collection that might break the scenario. """ do_stuff_ = get_fixture_value(request, get_step_fixture_name('I do stuff', WHEN)) assert callable(do_stuff_) check_stuff_ = get_fixture_value(request, get_step_fixture_name('I check stuff', THEN)) assert callable(check_stuff_)
def test_override(request, overridable): """Test locally overriden fixture.""" # Test the fixture is also collected by the text name fixture = get_fixture_value(request, get_step_fixture_name('I have locally overriden fixture', GIVEN)) assert fixture(request) == 'local' # 'I have the overriden fixture' stands for overridable and is overriden locally fixture = get_fixture_value(request, get_step_fixture_name('I have the overriden fixture', GIVEN)) assert fixture(request) == 'local' assert overridable == 'local'
def test_global_when_step(request): """Test when step defined in the parent conftest.""" get_fixture_value(request, get_step_fixture_name('I use a when step from the parent conftest', WHEN))
def test_multiline(request): assert get_fixture_value(request, 'i_have_text') == expected_text