# Specification: Test Suite Stabilization & Consolidation (test_stabilization_20260302) ## Overview The goal of this track is to stabilize and unify the project's test suite. This involves resolving pervasive `asyncio` lifecycle errors, consolidating redundant testing paradigms (specifically manual GUI subprocesses), ensuring artifact isolation in `./tests/artifacts/`, and implementing functional assertions for currently mocked-out tests. ## Functional Requirements - **Asyncio Lifecycle Stabilization:** - Resolve `RuntimeError: Event loop is closed` across the suite. - Implement `ThreadPoolExecutor` for blocking calls in GUI-bound tests. - Audit and fix fixture cleanup in `conftest.py`. - **Paradigm Consolidation (from testing_consolidation_20260302):** - Refactor integration/visual tests to exclusively use the `live_gui` pytest fixture. - Eliminate all manual `subprocess.Popen` calls to `gui_2.py` in the `tests/` and `simulation/` directories. - **Artifact Isolation & Discipline:** - All test-generated files (temporary projects, mocks, sessions) MUST be isolated in `./tests/artifacts/`. - Prevent leakage into `conductor/tracks/` or project root. - **Enhanced Test Reporting:** - Implement structured, sectioned logging in `./tests/logs/` with timestamps. - **Assertion Implementation:** - Replace `pytest.fail` placeholders with full functional implementation. - **Simulation Regression Fixes:** - Debug and resolve `test_context_sim_live` entry count issues. ## Acceptance Criteria - [ ] Full suite run completes without `RuntimeError: Event loop is closed` warnings. - [ ] No `subprocess.Popen` calls to `gui_2.py` exist in the test codebase. - [ ] All test artifacts are isolated in `./tests/artifacts/`. - [ ] All tests previously marked with `pytest.fail` now have passing functional assertions. - [ ] Simulation tests pass with correct entry counts.