MCPcopy Create free account
hub / github.com/pytest-dev/pytest-bdd / when

Function when

src/pytest_bdd/steps.py:97–113  ·  view source on GitHub ↗

When step decorator. :param name: Step name or a parser object. :param converters: Optional `dict` of the argument or parameter converters in form { : }. :param target_fixture: Target fixture name to replace by steps definition funct

(
    name: str | StepParser,
    converters: dict[str, Callable[[str], Any]] | None = None,
    target_fixture: str | None = None,
    stacklevel: int = 1,
)

Source from the content-addressed store, hash-verified

95
96
97def when(
98 name: str | StepParser,
99 converters: dict[str, Callable[[str], Any]] | None = None,
100 target_fixture: str | None = None,
101 stacklevel: int = 1,
102) -> Callable[[Callable[P, T]], Callable[P, T]]:
103 """When step decorator.
104
105 :param name: Step name or a parser object.
106 :param converters: Optional `dict` of the argument or parameter converters in form
107 {<param_name>: <converter function>}.
108 :param target_fixture: Target fixture name to replace by steps definition function.
109 :param stacklevel: Stack level to find the caller frame. This is used when injecting the step definition fixture.
110
111 :return: Decorator function for the step.
112 """
113 return step(name, WHEN, converters=converters, target_fixture=target_fixture, stacklevel=stacklevel)
114
115
116def then(

Callers

nothing calls this directly

Calls 1

stepFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…