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

Function test_lifespan_direct_debug_mode

tests/api_utils/test_app.py:641–666  ·  view source on GitHub ↗

Test lifespan with direct_debug_no_browser mode.

()

Source from the content-addressed store, hash-verified

639
640@pytest.mark.asyncio
641async def test_lifespan_direct_debug_mode():
642 """Test lifespan with direct_debug_no_browser mode."""
643 app_mock = MagicMock()
644
645 # Page not ready, but mode allows it
646 state.is_page_ready = False
647
648 with (
649 patch("api_utils.app._setup_logging", return_value=(None, None)),
650 patch("api_utils.app._initialize_globals"),
651 patch("api_utils.app._initialize_proxy_settings"),
652 patch("api_utils.app.load_excluded_models"),
653 patch("api_utils.app._start_stream_proxy", new_callable=AsyncMock),
654 patch("api_utils.app._initialize_browser_and_page", new_callable=AsyncMock),
655 patch("api_utils.app._shutdown_resources", new_callable=AsyncMock),
656 patch("api_utils.queue_worker", new_callable=AsyncMock),
657 patch("api_utils.app.restore_original_streams"),
658 patch(
659 "api_utils.app.get_environment_variable",
660 return_value="direct_debug_no_browser",
661 ),
662 ):
663 from api_utils.app import lifespan
664
665 async with lifespan(app_mock):
666 assert state.worker_task is not None
667
668
669@pytest.mark.asyncio

Callers

nothing calls this directly

Calls 1

lifespanFunction · 0.90

Tested by

no test coverage detected