Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Apr 24, 2023
1 parent db90668 commit c7951a4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/pytest_bdd/scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def _execute_step_function(
inject_fixture(request=request, arg=arg, value=return_value)
else:
target_fixture_tokens = [token for token in context.target_fixture.split(",") if token]
# Single return value in target_fixture
# Single return value in target_fixture
if len(target_fixture_tokens) == 1:
inject_fixture(request=request, arg=target_fixture_tokens[0], value=return_value)
# Multiple comma separated return values in target_fixture
Expand Down
9 changes: 8 additions & 1 deletion src/pytest_bdd/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,14 @@ def when(
:return: Decorator function for the step.
"""
return step(name, WHEN, converters=converters, target_fixture=target_fixture, target_exception=target_exception, stacklevel=stacklevel)
return step(
name,
WHEN,
converters=converters,
target_fixture=target_fixture,
target_exception=target_exception,
stacklevel=stacklevel,
)


def then(
Expand Down
2 changes: 1 addition & 1 deletion tests/feature/test_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ def test_when_exception(pytester):
@scenario("when_exception.feature", "Test when exception is generated")
def test_when_exception():
pass
@when("I have injected exception", target_fixture="foo")
def _():
return Exception("Dummy Exception obj")
Expand Down

0 comments on commit c7951a4

Please sign in to comment.