-
Notifications
You must be signed in to change notification settings - Fork 249
Expand file tree
/
Copy pathhooks.py
More file actions
74 lines (53 loc) · 2.1 KB
/
Copy pathhooks.py
File metadata and controls
74 lines (53 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
from __future__ import annotations
from collections.abc import Callable
import pytest
from _pytest.fixtures import FixtureRequest
from pytest_bdd.parser import Feature, Scenario, Step
"""Pytest-bdd pytest hooks."""
def pytest_bdd_before_scenario(request: FixtureRequest, feature: Feature, scenario: Scenario) -> object:
"""Called before scenario is executed."""
def pytest_bdd_after_scenario(request: FixtureRequest, feature: Feature, scenario: Scenario) -> object:
"""Called after scenario is executed."""
def pytest_bdd_before_step(
request: FixtureRequest, feature: Feature, scenario: Scenario, step: Step, step_func: Callable[..., object]
) -> object:
"""Called before step function is set up."""
def pytest_bdd_before_step_call(
request: FixtureRequest,
feature: Feature,
scenario: Scenario,
step: Step,
step_func: Callable[..., object],
step_func_args: dict[str, object],
) -> object:
"""Called before step function is executed."""
def pytest_bdd_after_step(
request: FixtureRequest,
feature: Feature,
scenario: Scenario,
step: Step,
step_func: Callable[..., object],
step_func_args: dict[str, object],
) -> object:
"""Called after step function is successfully executed."""
def pytest_bdd_step_error(
request: FixtureRequest,
feature: Feature,
scenario: Scenario,
step: Step,
step_func: Callable[..., object],
step_func_args: dict[str, object],
exception: BaseException,
) -> object:
"""Called when step function failed to execute."""
def pytest_bdd_step_func_lookup_error(
request: FixtureRequest, feature: Feature, scenario: Scenario, step: Step, exception: Exception
) -> object:
"""Called when step lookup failed."""
@pytest.hookspec(firstresult=True)
def pytest_bdd_apply_tag(tag: str, function: Callable[..., object]) -> object:
"""Apply a tag (from a ``.feature`` file) to the given scenario.
The default implementation does the equivalent of
``getattr(pytest.mark, tag)(function)``, but you can override this hook and
return ``True`` to do more sophisticated handling of tags.
"""