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

Function _eval_scope_callable

src/_pytest/fixtures.py:1027–1047  ·  view source on GitHub ↗
(
    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 # Type ignored because there is no typing mechanism to specify
1034 # keyword arguments, currently.
1035 result = scope_callable(fixture_name=fixture_name, config=config) # type: ignore[call-arg]
1036 except Exception as e:
1037 raise TypeError(
1038 f"Error evaluating {scope_callable} while defining fixture '{fixture_name}'.\n"
1039 "Expected a function with the signature (*, fixture_name, config)"
1040 ) from e
1041 if not isinstance(result, str):
1042 fail(
1043 f"Expected {scope_callable} to return a 'str' while defining fixture '{fixture_name}', but it returned:\n"
1044 f"{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

Used in the wild real call sites across dependent graphs

searching dependent graphs…