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'
Exemple #2
0
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_ = 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_)
Exemple #3
0
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'
Exemple #5
0
def test_override(request, overridable):
    """Test locally overriden fixture."""

    # Test the fixture is also collected by the text name
    fixture = request.getfixturevalue(
        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 = request.getfixturevalue(
        get_step_fixture_name("I have the overriden fixture", GIVEN))
    assert fixture(request) == "local"

    assert overridable == "local"
Exemple #6
0
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.'
Exemple #7
0
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))
Exemple #8
0
def test_global_when_step(request):
    """Test when step defined in the parent conftest."""
    request.getfixturevalue(
        get_step_fixture_name("I use a when step from the parent conftest",
                              WHEN))