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

This commit is contained in:
2026-02-28 19:20:41 -05:00
parent e8513d563b
commit ee2d6f4234
9 changed files with 34 additions and 27 deletions

View File

@@ -1,15 +1,16 @@
import os
import shutil
import pytest
import shutil
import os
import tomllib
from pathlib import Path
from datetime import datetime
from unittest.mock import patch
from typing import Generator
import session_logger
import tomllib
@pytest.fixture
def temp_logs(tmp_path, monkeypatch):
# Ensure closed before starting
def temp_logs(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> Generator[Path, None, None]:
# Ensure closed before starting
session_logger.close_session()
monkeypatch.setattr(session_logger, "_comms_fh", None)
# Mock _LOG_DIR in session_logger
@@ -28,7 +29,8 @@ def temp_logs(tmp_path, monkeypatch):
session_logger._LOG_DIR = original_log_dir
session_logger._SCRIPTS_DIR = original_scripts_dir
def test_open_session_creates_subdir_and_registry(temp_logs):
def test_open_session_creates_subdir_and_registry(temp_logs: Path) -> None:
label = "test-label"
# We can't easily mock datetime.datetime.now() because it's a built-in
# but we can check the resulting directory name pattern