Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion services/orchestrator/pytest.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[tool:pytest]
[pytest]
testpaths = tests
python_files = test_*.py
python_classes = Test*
Expand All @@ -23,6 +23,7 @@ markers =
a2a: marks tests as A2A protocol tests
mcp: marks tests as MCP functionality tests
database: marks tests that require database connection
goals: marks tests for Goals Management functionality
asyncio_mode = auto
filterwarnings =
ignore::DeprecationWarning
Expand Down
16 changes: 16 additions & 0 deletions services/orchestrator/tests/test_a2a_stub.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
Stub module for the a2a marker so 'pytest -m a2a' exits with 0 instead of 5.

The bespoke A2AProtocol implementation (AgentCapability, TaskDelegation) was
superseded by the open-standard A2A contract in PR #73 and the full test suite
was quarantined in #76. This file keeps the marker alive in the collection so
the CI step does not fail with "no tests collected" (exit code 5).
"""

import pytest


@pytest.mark.a2a
def test_a2a_bespoke_protocol_retired() -> None:
"""Bespoke A2A protocol is superseded by open-standard A2A (#73)."""
pytest.skip("bespoke a2a_protocol superseded by #73; full suite in #76")
2 changes: 2 additions & 0 deletions services/orchestrator/tests/test_goals_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
)
from services.orchestrator.milestone_task_engine import MilestoneTaskEngine

pytestmark = pytest.mark.goals


class TestGoalsManagementService:
"""Test GoalsManagementService"""
Expand Down
26 changes: 14 additions & 12 deletions services/orchestrator/tests/test_hierarchy_ws_authz.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import importlib
import os
import sys
from unittest.mock import AsyncMock, MagicMock
from unittest.mock import AsyncMock, MagicMock, patch

import pytest

Expand All @@ -39,7 +39,6 @@
os.environ.pop("AUTH_DISABLED", None)
os.environ.pop("JWT_AUDIENCE", None)
os.environ.pop("JWT_ISSUER", None)
os.environ["DATABASE_URL"] = "postgresql://postgres:postgres@localhost:5434/ai_context"
os.environ["ORCHESTRATOR_URL"] = "http://localhost:8000"

# Add repo root to sys.path so ``import hierarchy_endpoints`` resolves.
Expand All @@ -59,13 +58,6 @@

importlib.reload(auth_module)

# Stub asyncpg.create_pool so the startup handler doesn't need a real DB.
import asyncpg # noqa: E402

_mock_pool = MagicMock()
_mock_pool.close = AsyncMock()
asyncpg.create_pool = AsyncMock(return_value=_mock_pool) # type: ignore[attr-defined]

# Now import the REAL hierarchy_endpoints app (it uses the already-loaded auth).
import hierarchy_endpoints # noqa: E402

Expand All @@ -87,9 +79,19 @@ def make_token(**extra) -> str:

@pytest.fixture(scope="module")
def hier_client():
"""TestClient wrapping the REAL hierarchy_endpoints.app."""
with TestClient(app) as c:
yield c
"""TestClient wrapping the REAL hierarchy_endpoints.app.

asyncpg.create_pool is patched within this fixture's scope so the
hierarchy_endpoints startup handler never opens a real DB connection.
The patch is properly restored after all module-scoped tests finish,
leaving the asyncpg module unmodified for the rest of the test session.
"""
_mock_pool = MagicMock()
_mock_pool.close = AsyncMock()
with patch("asyncpg.create_pool", new_callable=AsyncMock) as mock_cp:
mock_cp.return_value = _mock_pool
with TestClient(app) as c:
yield c


# ---------------------------------------------------------------------------
Expand Down