| 1025 | |
| 1026 | |
| 1027 | def _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 | |
| 1050 | class FixtureDef(Generic[FixtureValue]): |