44 """Drive `run_endpoint(session)` on a fresh event loop, capturing the thread
45 id set_config executed on and the event-loop thread id. Returns (loop_tid,
47 captured: dict[str, int] = {}
48 real_set_config = state_mod.AppState.set_config
50 def spy(self, *args, **kwargs):
51 captured[
"set_config_tid"] = threading.get_ident()
52 return real_set_config(self, *args, **kwargs)
55 captured[
"loop_tid"] = threading.get_ident()
56 session = get_session(
_request(
"offload-test@berkeley.edu"))
57 assert session.app_state.has_config(),
"default config should be loaded"
58 state_mod.AppState.set_config = spy
60 await run_endpoint(session)
62 state_mod.AppState.set_config = real_set_config
65 return captured.get(
"loop_tid"), captured.get(
"set_config_tid")