(
fixturefunc: _FixtureFunc[FixtureValue], request: FixtureRequest, kwargs
)
| 989 | |
| 990 | |
| 991 | def call_fixture_func( |
| 992 | fixturefunc: _FixtureFunc[FixtureValue], request: FixtureRequest, kwargs |
| 993 | ) -> FixtureValue: |
| 994 | if inspect.isgeneratorfunction(fixturefunc): |
| 995 | fixturefunc = cast(Callable[..., Generator[FixtureValue]], fixturefunc) |
| 996 | generator = fixturefunc(**kwargs) |
| 997 | try: |
| 998 | fixture_result = next(generator) |
| 999 | except StopIteration: |
| 1000 | raise ValueError(f"{request.fixturename} did not yield a value") from None |
| 1001 | finalizer = functools.partial(_teardown_yield_fixture, fixturefunc, generator) |
| 1002 | request.addfinalizer(finalizer) |
| 1003 | else: |
| 1004 | fixturefunc = cast(Callable[..., FixtureValue], fixturefunc) |
| 1005 | fixture_result = fixturefunc(**kwargs) |
| 1006 | return fixture_result |
| 1007 | |
| 1008 | |
| 1009 | def _teardown_yield_fixture(fixturefunc, it) -> None: |
no test coverage detected