MCPcopy
hub / github.com/pytest-dev/pytest / _eval_scope_callable

Function _eval_scope_callable

src/_pytest/fixtures.py:1027–1047  ·  src/_pytest/fixtures.py::_eval_scope_callable
(
    scope_callable: Callable[[str, Config], ScopeName],
    fixture_name: str,
    config: Config,
)

Source from the content-addressed store, hash-verified

1025
1026
1027def _eval_scope_callable(
1028 scope_callable: Callable[[str, Config], ScopeName],
1029 fixture_name: str,
1030 config: Config,
1031) -> ScopeName:
1032 try:
1033 class="cm"># Type ignored because there is no typing mechanism to specify
1034 class="cm"># keyword arguments, currently.
1035 result = scope_callable(fixture_name=fixture_name, config=config) class="cm"># type: ignore[call-arg]
1036 except Exception as e:
1037 raise TypeError(
1038 fclass="st">"Error evaluating {scope_callable} while defining fixture &class="cm">#x27;{fixture_name}'.\n"
1039 class="st">"Expected a function with the signature (*, fixture_name, config)"
1040 ) from e
1041 if not isinstance(result, str):
1042 fail(
1043 fclass="st">"Expected {scope_callable} to return a &class="cm">#x27;str' while defining fixture '{fixture_name}', but it returned:\n"
1044 fclass="st">"{result!r}",
1045 pytrace=False,
1046 )
1047 return result
1048
1049
1050class FixtureDef(Generic[FixtureValue]):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected