diff --git a/tests/orchestrator/conftest.py b/tests/orchestrator/conftest.py index 54d30c6..13f7a69 100644 --- a/tests/orchestrator/conftest.py +++ b/tests/orchestrator/conftest.py @@ -10,7 +10,15 @@ import pytest # Add project root to path -sys.path.insert(0, str(Path(__file__).parent.parent.parent)) +_PROJECT_ROOT = Path(__file__).parent.parent.parent +sys.path.insert(0, str(_PROJECT_ROOT)) + +# run_orchestrator.py was moved out of the project root into _archive/old_runners/ +# by the root cleanup in aa41933 ("chore: Clean root, update README, archive old +# scripts"). That commit moved 18 runner scripts but did not update the tests that +# import them, so this conftest - and with it the whole pytest session - failed to +# collect. Keep the archived location importable so these tests keep running. +sys.path.insert(0, str(_PROJECT_ROOT / "_archive" / "old_runners")) from run_orchestrator import OrchestratorConfig, PhaseResult diff --git a/tests/orchestrator/test_fail_forward_diff.py b/tests/orchestrator/test_fail_forward_diff.py index 0792e4e..b397acf 100644 --- a/tests/orchestrator/test_fail_forward_diff.py +++ b/tests/orchestrator/test_fail_forward_diff.py @@ -96,6 +96,9 @@ def make_orchestrator(max_parallel: int = 1) -> EpicOrchestrator: orch.task_executor.execute_task = AsyncMock( return_value=TaskExecutionResult(success=True, output="OK", error=None) ) + # See test_pipeline_executor.make_orchestrator: __init__ is bypassed here, so the + # real __init__'s self.db_sync = None default has to be mirrored explicitly. + orch.db_sync = None return orch diff --git a/tests/orchestrator/test_pipeline_executor.py b/tests/orchestrator/test_pipeline_executor.py index f0dd8a9..f8f2799 100644 --- a/tests/orchestrator/test_pipeline_executor.py +++ b/tests/orchestrator/test_pipeline_executor.py @@ -81,6 +81,11 @@ def make_orchestrator(max_parallel: int = 3) -> EpicOrchestrator: orch.task_executor = MagicMock() orch.task_executor.execute_task = AsyncMock(return_value=make_success_result()) orch._convergence_ran_diff = False # Phase 28 + # This helper bypasses __init__, so every attribute the real __init__ sets has to + # be mirrored here. EpicOrchestrator.__init__ sets self.db_sync = None and only + # replaces it when DBTaskSync imports successfully, so None is the faithful + # default: _update_task_status() then skips the live DB write. + orch.db_sync = None return orch diff --git a/tests/test_code_quality_agent.py b/tests/test_code_quality_agent.py index 466a671..417f537 100644 --- a/tests/test_code_quality_agent.py +++ b/tests/test_code_quality_agent.py @@ -16,10 +16,9 @@ # Add src to path sys.path.insert(0, str(Path(__file__).parent)) -from src.registry import ( - DocumentRegistry, - DocumentType, - DocumentStatus, +from src.registry.document_registry import DocumentRegistry +from src.registry.document_types import DocumentType, DocumentStatus +from src.registry.documents import ( QualityReport, TestSpec, TestResults, diff --git a/tests/test_document_registry.py b/tests/test_document_registry.py index 2188e84..e654881 100644 --- a/tests/test_document_registry.py +++ b/tests/test_document_registry.py @@ -18,10 +18,9 @@ # Add src to path sys.path.insert(0, str(Path(__file__).parent)) -from src.registry import ( - DocumentRegistry, - DocumentType, - DocumentStatus, +from src.registry.document_registry import DocumentRegistry +from src.registry.document_types import DocumentType, DocumentStatus +from src.registry.documents import ( DebugReport, ImplementationPlan, TestSpec, diff --git a/tests/test_pipeline_data_bucketer.py b/tests/test_pipeline_data_bucketer.py index 7f7ffb6..2b4ce34 100644 --- a/tests/test_pipeline_data_bucketer.py +++ b/tests/test_pipeline_data_bucketer.py @@ -4,9 +4,11 @@ import sys import unittest -sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "src")) +# Put the project root on sys.path, not src/ itself: src/secrets.py shadows the +# stdlib secrets module for the rest of the pytest session once src/ is on the path. +sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")) -from services.pipeline_data_bucketer import PipelineDataBucketer, PipelineDataBucketerState +from src.services.pipeline_data_bucketer import PipelineDataBucketer, PipelineDataBucketerState class TestBasic(unittest.TestCase): diff --git a/tests/test_pipeline_data_sequencer.py b/tests/test_pipeline_data_sequencer.py index 8538180..08ea1c2 100644 --- a/tests/test_pipeline_data_sequencer.py +++ b/tests/test_pipeline_data_sequencer.py @@ -4,9 +4,11 @@ import sys import unittest -sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "src")) +# Put the project root on sys.path, not src/ itself: src/secrets.py shadows the +# stdlib secrets module for the rest of the pytest session once src/ is on the path. +sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")) -from services.pipeline_data_sequencer import PipelineDataSequencer +from src.services.pipeline_data_sequencer import PipelineDataSequencer class TestBasic(unittest.TestCase):