File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -117,11 +117,13 @@ echo "启动 QuantClass Sync GUI..."
117117echo " "
118118
119119python quantclass_sync.py gui
120- if [ $? -ne 0 ]; then
120+ EXIT_CODE=$?
121+ if [ $EXIT_CODE -ne 0 ]; then
121122 echo " "
122123 echo " 程序异常退出,按任意键关闭..."
123124 read -n 1
125+ exit $EXIT_CODE
124126fi
125127
126- # GUI 正常退出后,自动关闭本终端窗口 (按名称匹配,不误关其他窗口)
128+ # 仅正常退出时自动关闭本终端窗口 (按名称匹配,不误关其他窗口)
127129osascript -e ' tell application "Terminal" to close (every window whose name contains "QuantClass Sync")' & > /dev/null &
Original file line number Diff line number Diff line change @@ -210,14 +210,16 @@ def test_s1_6_gui_mock_webview(self):
210210 """
211211 mock_webview = MagicMock ()
212212 with patch .dict ("sys.modules" , {"webview" : mock_webview }), \
213- patch ("os._exit" ): # launch_gui 结束时调用 os._exit(0)
213+ patch ("os._exit" ) as mock_exit : # launch_gui 结束时调用 os._exit(0)
214214 # 在 mock 生效后再调用,确保函数内 import webview 拿到 mock
215215 from quantclass_sync_internal .gui import launch_gui
216216 launch_gui ()
217217
218218 # 验证窗口创建和启动均被调用
219219 mock_webview .create_window .assert_called_once ()
220220 mock_webview .start .assert_called_once ()
221+ # 验证窗口关闭后触发进程退出
222+ mock_exit .assert_called_once_with (0 )
221223
222224
223225class TestS2GUISmoke (unittest .TestCase ):
You can’t perform that action at this time.
0 commit comments