Skip to content

Commit 0a8a4e3

Browse files
dsax7hristiy4n
authored andcommitted
Use the skip hook and plugin if the step is skipped
- trigger the skip hook if a step is skipped
1 parent a2e48b1 commit 0a8a4e3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/pytest_bdd/scenario.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import pytest
2222
from _pytest.fixtures import FixtureDef, FixtureManager, FixtureRequest, call_fixture_func
2323
from _pytest.nodes import iterparentnodeids
24+
from _pytest.outcomes import Skipped
2425

2526
from . import exceptions
2627
from .feature import get_feature, get_features
@@ -160,6 +161,9 @@ def _execute_step_function(
160161
except Exception as exception:
161162
request.config.hook.pytest_bdd_step_error(exception=exception, **kw)
162163
raise
164+
except Skipped as exception:
165+
request.config.hook.pytest_bdd_step_skip(exception=exception, **kw)
166+
raise
163167

164168
if context.target_fixture is not None:
165169
inject_fixture(request, context.target_fixture, return_value)

0 commit comments

Comments
 (0)