chore(tech-debt): Finalize gui_2.py cleanup and test suite discipline

This commit is contained in:
2026-03-02 21:43:56 -05:00
parent 8af1bcd960
commit a569f8c02f
26 changed files with 58 additions and 364 deletions

View File

@@ -1,4 +1,3 @@
from typing import Generator
import pytest
from unittest.mock import patch, ANY
import asyncio
@@ -6,32 +5,6 @@ import time
from gui_2 import App
from events import UserRequestEvent
@pytest.fixture
def mock_app() -> Generator[App, None, None]:
with (
patch('gui_2.load_config', return_value={
"ai": {"provider": "gemini", "model": "model-1", "temperature": 0.0, "max_tokens": 100, "history_trunc_limit": 1000},
"projects": {"paths": [], "active": ""},
"gui": {"show_windows": {}}
}),
patch('gui_2.project_manager.load_project', return_value={
"project": {"name": "test_proj"},
"discussion": {"active": "main", "discussions": {"main": {"history": []}}},
"files": {"paths": [], "base_dir": "."},
"screenshots": {"paths": [], "base_dir": "."},
"agent": {"tools": {}}
}),
patch('gui_2.project_manager.migrate_from_legacy_config', return_value={}),
patch('gui_2.project_manager.save_project'),
patch('gui_2.session_logger.open_session'),
patch('gui_2.App._init_ai_and_hooks'),
patch('gui_2.App._fetch_models')
):
app = App()
yield app
# We don't have a clean way to stop the loop thread in gui_2.py App
# so we just let it daemon-exit.
@pytest.mark.timeout(10)
def test_user_request_integration_flow(mock_app: App) -> None:
"""