File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed
Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -540,16 +540,14 @@ def _can_substitute(item: Function) -> bool:
540540
541541 def setup (self ) -> None :
542542 runner_fixture_id = f"_{ self ._loop_scope } _scoped_runner"
543- if runner_fixture_id in self .fixturenames :
544- return super (). setup ( )
545- # The runner must be resolved before async fixtures when loop
546- # factories are configured. Otherwise, the async fixtures see a
547- # stale loop from the previous factory .
543+ if runner_fixture_id not in self .fixturenames :
544+ self . fixturenames . append ( runner_fixture_id )
545+ # When loop factories are configured, resolve the loop factory
546+ # fixture early so that a factory variant change cascades cache
547+ # invalidation before any async fixture checks its cache .
548548 hook_caller = self .config .hook .pytest_asyncio_loop_factories
549549 if hook_caller .get_hookimpls ():
550- self .fixturenames .insert (0 , runner_fixture_id )
551- else :
552- self .fixturenames .append (runner_fixture_id )
550+ _ = self ._request .getfixturevalue (_asyncio_loop_factory .__name__ )
553551 return super ().setup ()
554552
555553 def runtest (self ) -> None :
You can’t perform that action at this time.
0 commit comments