"""gui/web_gui 的 import 冒烟测试。 老版本会真实启动 HTTP 服务并请求 /api/config,pytest 运行时会卡住。 重写为只验证模块能正常加载、关键属性存在;启动服务的端到端验证留给手动测试。 """ from __future__ import annotations def test_web_gui_module_importable(): """模块能 import,不抛异常。""" import gui.web_gui as wg # 关键符号存在 assert hasattr(wg, "main"), "gui.web_gui 应导出 main()" assert callable(wg.main) def test_web_gui_helper_functions(): """模块级 helper 应可调用。""" import gui.web_gui as wg assert callable(wg.read_config) assert callable(wg.find_adb_executable) assert callable(wg.list_adb_devices) # _wg_log 是项目里 print→logger 改造引入的内部 helper assert callable(wg._wg_log) def test_web_gui_log_helper_does_not_raise(): """_wg_log 不应抛异常。""" import gui.web_gui as wg wg._wg_log("[smoke] info") wg._wg_log("[smoke] warn", level="WARNING") wg._wg_log("[smoke] error", level="ERROR")