refactor(tests): Add strict type hints to first batch of test files

This commit is contained in:
2026-02-28 19:06:50 -05:00
parent e8833b6656
commit f0415a40aa
10 changed files with 59 additions and 70 deletions

View File

@@ -8,7 +8,8 @@ import gui_2
from gui_2 import App
@pytest.fixture
def mock_config(tmp_path):
@pytest.fixture
def mock_config(tmp_path: Path) -> Path:
config_path = tmp_path / "config.toml"
config_path.write_text("""[projects]
paths = []
@@ -20,7 +21,8 @@ model = "model"
return config_path
@pytest.fixture
def mock_project(tmp_path):
@pytest.fixture
def mock_project(tmp_path: Path) -> Path:
project_path = tmp_path / "project.toml"
project_path.write_text("""[project]
name = "test"
@@ -33,7 +35,8 @@ history = []
return project_path
@pytest.fixture
def app_instance(mock_config, mock_project, monkeypatch):
@pytest.fixture
def app_instance(mock_config: Path, mock_project: Path, monkeypatch: pytest.MonkeyPatch) -> App:
monkeypatch.setattr("gui_2.CONFIG_PATH", mock_config)
with patch("project_manager.load_project") as mock_load, \
patch("session_logger.open_session"):
@@ -54,14 +57,14 @@ def app_instance(mock_config, mock_project, monkeypatch):
# but python allows calling it directly.
return app
def test_log_management_init(app_instance):
def test_log_management_init(app_instance: App) -> None:
app = app_instance
assert "Log Management" in app.show_windows
assert app.show_windows["Log Management"] is False
assert hasattr(app, "_render_log_management")
assert callable(app._render_log_management)
def test_render_log_management_logic(app_instance):
def test_render_log_management_logic(app_instance: App) -> None:
app = app_instance
app.show_windows["Log Management"] = True
# Mock LogRegistry