MCPcopy Create free account
hub / github.com/CJackHwang/AIstudioProxyAPI / reset_global_state

Function reset_global_state

tests/conftest.py:29–46  ·  view source on GitHub ↗

Reset GlobalState and ServerState before each test to ensure isolation.

()

Source from the content-addressed store, hash-verified

27
28@pytest.fixture(autouse=True)
29def reset_global_state():
30 """Reset GlobalState and ServerState before each test to ensure isolation."""
31 from api_utils.server_state import state
32 from config.global_state import GlobalState
33
34 GlobalState.reset_quota_status()
35 GlobalState.IS_RECOVERING = False
36 GlobalState.DEPLOYMENT_EMERGENCY_MODE = False
37 GlobalState.CURRENT_STREAM_REQ_ID = None
38 GlobalState.queued_request_count = 0
39 GlobalState.AUTH_ROTATION_LOCK.set() # Allow requests by default
40 GlobalState.QUOTA_EXCEEDED_EVENT.clear()
41 GlobalState.rotation_complete_event.clear()
42 GlobalState.RECOVERY_EVENT.set()
43 GlobalState.IS_SHUTTING_DOWN.clear()
44
45 state.reset()
46 yield
47
48
49@pytest.fixture(autouse=True)

Callers

nothing calls this directly

Calls 4

reset_quota_statusMethod · 0.80
setMethod · 0.80
resetMethod · 0.80
clearMethod · 0.45

Tested by

no test coverage detected