From 006bb114881172d4b8da8a02d3323bbb141f6a0c Mon Sep 17 00:00:00 2001 From: Ed_ Date: Tue, 9 Jun 2026 16:14:40 -0400 Subject: [PATCH] refactor(test): 5 test files use live_gui_workspace fixture instead of hardcoded path --- tests/test_rag_phase4_final_verify.py | 4 ++-- tests/test_rag_phase4_stress.py | 4 ++-- tests/test_saved_presets_sim.py | 9 ++++----- tests/test_tool_presets_sim.py | 4 ++-- tests/test_visual_sim_gui_ux.py | 4 ++-- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/tests/test_rag_phase4_final_verify.py b/tests/test_rag_phase4_final_verify.py index 20c0a52a..6f9a1c47 100644 --- a/tests/test_rag_phase4_final_verify.py +++ b/tests/test_rag_phase4_final_verify.py @@ -12,12 +12,12 @@ sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "s from src import api_hook_client @pytest.mark.integration -def test_phase4_final_verify(live_gui): +def test_phase4_final_verify(live_gui, live_gui_workspace): client = api_hook_client.ApiHookClient() assert client.wait_for_server(timeout=15), "Hook server did not start" # 1. Setup mock project data - workspace_dir = Path("tests/artifacts/live_gui_workspace") + workspace_dir = live_gui_workspace workspace_dir.mkdir(parents=True, exist_ok=True) # Create dummy files diff --git a/tests/test_rag_phase4_stress.py b/tests/test_rag_phase4_stress.py index bbc7d704..94447d40 100644 --- a/tests/test_rag_phase4_stress.py +++ b/tests/test_rag_phase4_stress.py @@ -12,13 +12,13 @@ sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "s from src import api_hook_client @pytest.mark.integration -def test_rag_large_codebase_verification_sim(live_gui): +def test_rag_large_codebase_verification_sim(live_gui, live_gui_workspace): client = api_hook_client.ApiHookClient() assert client.wait_for_server(timeout=15), "Hook server did not start" # 1. Setup mock large project data # Create 50 dummy files to test parallel indexing and incrementality - workspace_dir = Path("tests/artifacts/live_gui_workspace") + workspace_dir = live_gui_workspace workspace_dir.mkdir(parents=True, exist_ok=True) file_names = [f"file_{i}.txt" for i in range(50)] diff --git a/tests/test_saved_presets_sim.py b/tests/test_saved_presets_sim.py index 73d1ef72..caa1e49f 100644 --- a/tests/test_saved_presets_sim.py +++ b/tests/test_saved_presets_sim.py @@ -5,13 +5,13 @@ from pathlib import Path import tomli_w from src.api_hook_client import ApiHookClient -def test_preset_switching(live_gui): +def test_preset_switching(live_gui, live_gui_workspace): client = ApiHookClient() client.click("btn_reset") time.sleep(2) # Paths for presets - temp_workspace = Path("tests/artifacts/live_gui_workspace") + temp_workspace = live_gui_workspace global_presets_path = temp_workspace / "presets.toml" project_presets_path = temp_workspace / "project_presets.toml" manual_slop_path = temp_workspace / "manual_slop.toml" @@ -96,7 +96,7 @@ def test_preset_switching(live_gui): if global_presets_path.exists(): global_presets_path.unlink() if project_presets_path.exists(): project_presets_path.unlink() -def test_preset_manager_modal(live_gui): +def test_preset_manager_modal(live_gui, live_gui_workspace): client = ApiHookClient() client.click("btn_reset") time.sleep(2) @@ -118,7 +118,6 @@ def test_preset_manager_modal(live_gui): time.sleep(1) # Verify it exists in file - temp_workspace = Path("tests/artifacts/live_gui_workspace") - global_presets_path = temp_workspace / "presets.toml" + global_presets_path = live_gui_workspace / "presets.toml" # assert global_presets_path.exists(), f"Global presets file not found at {global_presets_path}. Full state: {client.get_gui_state()}" diff --git a/tests/test_tool_presets_sim.py b/tests/test_tool_presets_sim.py index 418e7faa..3a9f241d 100644 --- a/tests/test_tool_presets_sim.py +++ b/tests/test_tool_presets_sim.py @@ -6,11 +6,11 @@ import json from pathlib import Path from src.api_hook_client import ApiHookClient -def test_tool_preset_switching(live_gui): +def test_tool_preset_switching(live_gui, live_gui_workspace): client = ApiHookClient() # Paths for tool presets - temp_workspace = Path("tests/artifacts/live_gui_workspace") + temp_workspace = live_gui_workspace global_tool_presets_path = temp_workspace / "tool_presets.toml" project_tool_presets_path = temp_workspace / "project_tool_presets.toml" manual_slop_path = temp_workspace / "manual_slop.toml" diff --git a/tests/test_visual_sim_gui_ux.py b/tests/test_visual_sim_gui_ux.py index 4bf23942..44b8360d 100644 --- a/tests/test_visual_sim_gui_ux.py +++ b/tests/test_visual_sim_gui_ux.py @@ -57,7 +57,7 @@ def test_gui_ux_event_routing(live_gui) -> None: print("[SIM] Performance verified.") @pytest.mark.live -def test_gui_track_creation(live_gui) -> None: +def test_gui_track_creation(live_gui, live_gui_workspace) -> None: client = api_hook_client.ApiHookClient() client.click("btn_reset") time.sleep(2) @@ -76,7 +76,7 @@ def test_gui_track_creation(live_gui) -> None: # Verify track exists on disk # Path is calculated in _cb_create_track: track_id = f"{name.lower().replace(' ', '_')}_{date_suffix}" - temp_workspace = Path("tests/artifacts/live_gui_workspace") + temp_workspace = live_gui_workspace tracks_dir = temp_workspace / "conductor" / "tracks" assert tracks_dir.exists(), "Tracks directory not found"