From b8c15f8d929d79fb610433277576fcdf7eb04b99 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Tue, 9 Jun 2026 20:42:43 -0400 Subject: [PATCH] fix(test): per-run workspace under tests/artifacts/ (replaces tmp_path_factory) --- tests/conftest.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 458a25fa..f0be51eb 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -11,7 +11,12 @@ import shutil from pathlib import Path from typing import Generator, Any from unittest.mock import patch +project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) +if project_root not in sys.path: + sys.path.insert(0, project_root) +_RUN_ID = datetime.datetime.now().strftime("%Y%m%d_%H%M%S") +_RUN_WORKSPACE = Path(f"tests/artifacts/live_gui_workspace_{_RUN_ID}") thirdparty_dir = os.path.join(os.path.dirname(__file__), "..", "thirdparty") if thirdparty_dir not in sys.path: sys.path.insert(0, thirdparty_dir) @@ -448,9 +453,8 @@ class _LiveGuiHandle: """[M: tests/conftest.py:_LiveGuiHandle.ensure_alive]""" return self._respawn_count - @pytest.fixture(scope="session") -def live_gui(request, tmp_path_factory) -> Generator["_LiveGuiHandle", None, None]: +def live_gui(request) -> Generator["_LiveGuiHandle", None, None]: """ @@ -461,8 +465,8 @@ def live_gui(request, tmp_path_factory) -> Generator["_LiveGuiHandle", None, Non diag = VerificationLogger("live_gui_startup", "live_gui_diag") diag.log_state("GUI Script", "N/A", "gui_2.py") - # 1. Create a isolated workspace for the live GUI (in pytest tmp dir, not project tree) - temp_workspace = tmp_path_factory.mktemp("live_gui_workspace") + # 1. Create a isolated workspace for the live GUI (per-run timestamped folder under tests/artifacts/) + temp_workspace = _RUN_WORKSPACE if temp_workspace.exists(): for _ in range(5): try: