test(governance): format dispatcher imports
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 1s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Failing after 2m22s
CD Pipeline / build-and-deploy (push) Has been skipped
CD Pipeline / post-deploy-checks (push) Has been skipped
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 1s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Failing after 2m22s
CD Pipeline / build-and-deploy (push) Has been skipped
CD Pipeline / post-deploy-checks (push) Has been skipped
This commit is contained in:
@@ -15,7 +15,7 @@ Unit Tests — GovernanceDispatcher (Wave 2E)
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime, timezone, timedelta
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from unittest.mock import AsyncMock, MagicMock, patch
|
||||
|
||||
import pytest
|
||||
@@ -371,7 +371,9 @@ class TestDispatchGovernanceEvent:
|
||||
event = _make_governance_event()
|
||||
decision = _make_fused_decision(confidence=0.90)
|
||||
|
||||
from src.repositories.governance_remediation_dispatch_repo import DispatchAlreadyActive
|
||||
from src.repositories.governance_remediation_dispatch_repo import (
|
||||
DispatchAlreadyActive,
|
||||
)
|
||||
|
||||
with (
|
||||
patch(
|
||||
@@ -552,6 +554,7 @@ class TestRunGovernanceDispatcherLoop:
|
||||
def test_poll_unresolved_events_excludes_active_dispatch_rows(self):
|
||||
"""poll SQL 必須跳過已有 active dispatch 的事件,避免 backlog 餓死。"""
|
||||
import inspect
|
||||
|
||||
from src.services import governance_dispatcher
|
||||
|
||||
source = inspect.getsource(governance_dispatcher._poll_unresolved_events)
|
||||
@@ -585,7 +588,10 @@ class TestRunGovernanceDispatcherLoop:
|
||||
patch("asyncio.sleep", side_effect=mock_sleep),
|
||||
):
|
||||
import asyncio
|
||||
from src.services.governance_dispatcher import run_governance_dispatcher_loop
|
||||
|
||||
from src.services.governance_dispatcher import (
|
||||
run_governance_dispatcher_loop,
|
||||
)
|
||||
|
||||
with pytest.raises(asyncio.CancelledError):
|
||||
await run_governance_dispatcher_loop(interval_seconds=1)
|
||||
@@ -612,7 +618,10 @@ class TestRunGovernanceDispatcherLoop:
|
||||
patch("asyncio.sleep", side_effect=mock_sleep),
|
||||
):
|
||||
import asyncio
|
||||
from src.services.governance_dispatcher import run_governance_dispatcher_loop
|
||||
|
||||
from src.services.governance_dispatcher import (
|
||||
run_governance_dispatcher_loop,
|
||||
)
|
||||
|
||||
with pytest.raises(asyncio.CancelledError):
|
||||
await run_governance_dispatcher_loop(interval_seconds=1)
|
||||
|
||||
Reference in New Issue
Block a user