(
fixturefunc: "_FixtureFunc[FixtureValue]", request: FixtureRequest, kwargs
)
| 906 | |
| 907 | |
| 908 | def call_fixture_func( |
| 909 | fixturefunc: "_FixtureFunc[FixtureValue]", request: FixtureRequest, kwargs |
| 910 | ) -> FixtureValue: |
| 911 | if is_generator(fixturefunc): |
| 912 | fixturefunc = cast( |
| 913 | Callable[..., Generator[FixtureValue, None, None]], fixturefunc |
| 914 | ) |
| 915 | generator = fixturefunc(**kwargs) |
| 916 | try: |
| 917 | fixture_result = next(generator) |
| 918 | except StopIteration: |
| 919 | raise ValueError(f"{request.fixturename} did not yield a value") from None |
| 920 | finalizer = functools.partial(_teardown_yield_fixture, fixturefunc, generator) |
| 921 | request.addfinalizer(finalizer) |
| 922 | else: |
| 923 | fixturefunc = cast(Callable[..., FixtureValue], fixturefunc) |
| 924 | fixture_result = fixturefunc(**kwargs) |
| 925 | return fixture_result |
| 926 | |
| 927 | |
| 928 | def _teardown_yield_fixture(fixturefunc, it) -> None: |
no test coverage detected