code-to10 v6 A14 batch2: test E402/F401 cleanup plus touched-file residual E,F cleanup
(cherry picked from commit 1db02545f74c96b3b92be4fc32954659cec1f814) Reconcile-conflict: A14b E402 imports referencing cloud.handler_core (does not exist here; core methods live in server.py) — kept HEAD imports with incoming's noqa: E402 markers, dropped the unused core_mod import (verified unused elsewhere in both files).
This commit is contained in:
1 parent
bd55599859
commit
488aedbcad
26 files changed
+51
-80
No files matched your search
@@ -51,7 +51,6 @@ try:
|
|||||||
PG_MARKER_DDL,
|
PG_MARKER_DDL,
|
||||||
classify_dispatch,
|
classify_dispatch,
|
||||||
consume_platform_marker,
|
consume_platform_marker,
|
||||||
ensure_marker_table,
|
|
||||||
mark_platform_rerun,
|
mark_platform_rerun,
|
||||||
)
|
)
|
||||||
from cloud.attempt_ledger import (
|
from cloud.attempt_ledger import (
|
||||||
@@ -72,7 +71,6 @@ except ImportError:
|
|||||||
PG_MARKER_DDL,
|
PG_MARKER_DDL,
|
||||||
classify_dispatch,
|
classify_dispatch,
|
||||||
consume_platform_marker,
|
consume_platform_marker,
|
||||||
ensure_marker_table,
|
|
||||||
mark_platform_rerun,
|
mark_platform_rerun,
|
||||||
)
|
)
|
||||||
from cloud.attempt_ledger import (
|
from cloud.attempt_ledger import (
|
||||||
|
|||||||
@@ -22,10 +22,7 @@ try:
|
|||||||
from cloud.audit_loop_driver import (
|
from cloud.audit_loop_driver import (
|
||||||
ACTION_KINDS,
|
ACTION_KINDS,
|
||||||
LEDGER_EVENT_TYPES,
|
LEDGER_EVENT_TYPES,
|
||||||
Action,
|
|
||||||
LoopState,
|
|
||||||
apply_correction,
|
apply_correction,
|
||||||
build_ledger_event,
|
|
||||||
confirm_rebuild,
|
confirm_rebuild,
|
||||||
decide_audit,
|
decide_audit,
|
||||||
emit,
|
emit,
|
||||||
@@ -38,10 +35,7 @@ except ImportError:
|
|||||||
from cloud.audit_loop_driver import (
|
from cloud.audit_loop_driver import (
|
||||||
ACTION_KINDS,
|
ACTION_KINDS,
|
||||||
LEDGER_EVENT_TYPES,
|
LEDGER_EVENT_TYPES,
|
||||||
Action,
|
|
||||||
LoopState,
|
|
||||||
apply_correction,
|
apply_correction,
|
||||||
build_ledger_event,
|
|
||||||
confirm_rebuild,
|
confirm_rebuild,
|
||||||
decide_audit,
|
decide_audit,
|
||||||
emit,
|
emit,
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ try:
|
|||||||
check_g6_guard,
|
check_g6_guard,
|
||||||
check_rebuild_first_gate,
|
check_rebuild_first_gate,
|
||||||
classify_root_cause,
|
classify_root_cause,
|
||||||
collect_failed_checks,
|
|
||||||
confirm_acceptance_rebuild,
|
confirm_acceptance_rebuild,
|
||||||
decide_pushback,
|
decide_pushback,
|
||||||
deviation_is_blocking,
|
deviation_is_blocking,
|
||||||
@@ -64,7 +63,6 @@ except ImportError:
|
|||||||
check_g6_guard,
|
check_g6_guard,
|
||||||
check_rebuild_first_gate,
|
check_rebuild_first_gate,
|
||||||
classify_root_cause,
|
classify_root_cause,
|
||||||
collect_failed_checks,
|
|
||||||
confirm_acceptance_rebuild,
|
confirm_acceptance_rebuild,
|
||||||
decide_pushback,
|
decide_pushback,
|
||||||
deviation_is_blocking,
|
deviation_is_blocking,
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ _quota_exceeded(假 runner,不 dispatch),服务端点走本地
|
|||||||
|
|
||||||
import http.client
|
import http.client
|
||||||
import json
|
import json
|
||||||
import logging
|
|
||||||
import os
|
import os
|
||||||
import sqlite3
|
import sqlite3
|
||||||
import sys
|
import sys
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ from decimal import Decimal
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from cloud import server as _srv
|
|
||||||
from cloud.server import (
|
from cloud.server import (
|
||||||
DbRateLimiter,
|
DbRateLimiter,
|
||||||
RateLimiter,
|
RateLimiter,
|
||||||
@@ -77,7 +76,6 @@ try:
|
|||||||
)
|
)
|
||||||
except ImportError: # discover -s cloud/tests 时把项目根目录补进 sys.path
|
except ImportError: # discover -s cloud/tests 时把项目根目录补进 sys.path
|
||||||
sys.path.insert(0, str(Path(__file__).resolve().parents[2]))
|
sys.path.insert(0, str(Path(__file__).resolve().parents[2]))
|
||||||
from cloud import server as _srv
|
|
||||||
from cloud.server import (
|
from cloud.server import (
|
||||||
DbRateLimiter,
|
DbRateLimiter,
|
||||||
RateLimiter,
|
RateLimiter,
|
||||||
@@ -264,7 +262,6 @@ class PathHelpersTestCase(unittest.TestCase):
|
|||||||
self.assertIsNone(path)
|
self.assertIsNone(path)
|
||||||
self.assertEqual(err[0], 409)
|
self.assertEqual(err[0], 409)
|
||||||
# 异机 worktree 409。
|
# 异机 worktree 409。
|
||||||
import socket
|
|
||||||
path, err = _task_worktree_for_files(
|
path, err = _task_worktree_for_files(
|
||||||
_StubServer(tenants_root="/tmp/t"),
|
_StubServer(tenants_root="/tmp/t"),
|
||||||
{"id": "t1", "worktree_host": "definitely-not-this-host-xyz"})
|
{"id": "t1", "worktree_host": "definitely-not-this-host-xyz"})
|
||||||
@@ -421,7 +418,7 @@ class TraceReadTestCase(unittest.TestCase):
|
|||||||
|
|
||||||
def test_build_agent_chain(self):
|
def test_build_agent_chain(self):
|
||||||
# 主任务 + 模型子代理 + 委派子任务(done)三路。
|
# 主任务 + 模型子代理 + 委派子任务(done)三路。
|
||||||
parent = self._write("task1.jsonl", [
|
self._write("task1.jsonl", [
|
||||||
json.dumps({"id": "c1", "thread": "main-th", "kind": "message",
|
json.dumps({"id": "c1", "thread": "main-th", "kind": "message",
|
||||||
"text": "hi", "ts": 10}),
|
"text": "hi", "ts": 10}),
|
||||||
json.dumps({"id": "c2", "thread": "sub-th", "kind": "message",
|
json.dumps({"id": "c2", "thread": "sub-th", "kind": "message",
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import sqlite3
|
|||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
import time
|
|
||||||
import unittest
|
import unittest
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
@@ -506,7 +505,8 @@ class WorkerDbTestCase(unittest.TestCase):
|
|||||||
|
|
||||||
fake2 = Worker(self.db_path, "/fake/host.py",
|
fake2 = Worker(self.db_path, "/fake/host.py",
|
||||||
env={"XCM_API_KEY": "x"},
|
env={"XCM_API_KEY": "x"},
|
||||||
repos_runner=lambda cmd, timeout=None: (_ for _ in ()).throw(TypeError("one-arg only")) if False else two_arg(cmd, timeout))
|
repos_runner=(lambda cmd, timeout=None: (_ for _ in ()).throw(TypeError("one-arg only"))
|
||||||
|
if False else two_arg(cmd, timeout)))
|
||||||
# 上面 fake2 的 runner 本身接受两参,直接验证两参路径。
|
# 上面 fake2 的 runner 本身接受两参,直接验证两参路径。
|
||||||
self.assertEqual(fake2._run_git(["git"]), ("two", None))
|
self.assertEqual(fake2._run_git(["git"]), ("two", None))
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import tempfile
|
|||||||
import unittest
|
import unittest
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from cloud import full_auto
|
|
||||||
from cloud.full_auto import (
|
from cloud.full_auto import (
|
||||||
FullAutoDenied,
|
FullAutoDenied,
|
||||||
FullAutoError,
|
FullAutoError,
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
套件覆盖,本文件不重复测路由,只测抽出子块本身。
|
套件覆盖,本文件不重复测路由,只测抽出子块本身。
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
|
||||||
import sys
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|||||||
@@ -20,8 +20,7 @@ try:
|
|||||||
from cloud.cost import CostStore, dual_column_view, price_usd_micros
|
from cloud.cost import CostStore, dual_column_view, price_usd_micros
|
||||||
from cloud.ledger import (
|
from cloud.ledger import (
|
||||||
GENESIS_HASH, LedgerStore, append_pushback_round,
|
GENESIS_HASH, LedgerStore, append_pushback_round,
|
||||||
audit_timeline, export_chain, list_pushback_rounds,
|
list_pushback_rounds, verify_export)
|
||||||
module_failure_counts, verify_chain, verify_export)
|
|
||||||
from cloud.server import create_server, init_db
|
from cloud.server import create_server, init_db
|
||||||
except ImportError: # discover -s cloud/tests 时把项目根目录补进 sys.path
|
except ImportError: # discover -s cloud/tests 时把项目根目录补进 sys.path
|
||||||
sys.path.insert(0, str(Path(__file__).resolve().parents[2]))
|
sys.path.insert(0, str(Path(__file__).resolve().parents[2]))
|
||||||
@@ -29,8 +28,8 @@ except ImportError: # discover -s cloud/tests 时把项目根目录补进 sys.p
|
|||||||
from cloud.cost import CostStore, dual_column_view, price_usd_micros
|
from cloud.cost import CostStore, dual_column_view, price_usd_micros
|
||||||
from cloud.ledger import (
|
from cloud.ledger import (
|
||||||
GENESIS_HASH, LedgerStore, append_pushback_round,
|
GENESIS_HASH, LedgerStore, append_pushback_round,
|
||||||
audit_timeline, export_chain, list_pushback_rounds,
|
list_pushback_rounds,
|
||||||
module_failure_counts, verify_chain, verify_export)
|
verify_export)
|
||||||
from cloud.server import create_server, init_db
|
from cloud.server import create_server, init_db
|
||||||
|
|
||||||
|
|
||||||
@@ -442,7 +441,7 @@ class TestTightenedCaliber(unittest.TestCase):
|
|||||||
contract_refrozen=True)
|
contract_refrozen=True)
|
||||||
|
|
||||||
def test_meta_review_correction_changes_effective_count(self):
|
def test_meta_review_correction_changes_effective_count(self):
|
||||||
first = self._verdict("fail")
|
self._verdict("fail")
|
||||||
self._verdict("fail")
|
self._verdict("fail")
|
||||||
third = self._verdict("fail")
|
third = self._verdict("fail")
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
|
|||||||
@@ -31,26 +31,22 @@ from unittest import mock
|
|||||||
REPO_ROOT = Path(__file__).resolve().parents[2]
|
REPO_ROOT = Path(__file__).resolve().parents[2]
|
||||||
sys.path.insert(0, str(REPO_ROOT))
|
sys.path.insert(0, str(REPO_ROOT))
|
||||||
|
|
||||||
import cloud.server as server_mod
|
import cloud.server as server_mod # noqa: E402
|
||||||
from cloud import evidence_binding
|
from cloud.evidence_binding import ( # noqa: E402
|
||||||
from cloud import gate_verification
|
|
||||||
from cloud import ledger_onboarding
|
|
||||||
from cloud import ledger_outbox
|
|
||||||
from cloud.evidence_binding import (
|
|
||||||
EvidenceNonceStore,
|
EvidenceNonceStore,
|
||||||
bind_evidence,
|
bind_evidence,
|
||||||
binding_presence,
|
binding_presence,
|
||||||
validate_bound_evidence,
|
validate_bound_evidence,
|
||||||
)
|
)
|
||||||
from cloud.gate_verification import verify_gate_evidence
|
from cloud.gate_verification import verify_gate_evidence # noqa: E402
|
||||||
from cloud.ledger_onboarding import _table_columns, verify_ledger_ready
|
from cloud.ledger_onboarding import _table_columns, verify_ledger_ready # noqa: E402
|
||||||
from cloud.ledger_outbox import (
|
from cloud.ledger_outbox import ( # noqa: E402
|
||||||
append_failure,
|
append_failure,
|
||||||
outbox_path_for,
|
outbox_path_for,
|
||||||
read_failures,
|
read_failures,
|
||||||
replay_failures,
|
replay_failures,
|
||||||
)
|
)
|
||||||
from cloud.server import CloudControlPlaneHandler, init_db
|
from cloud.server import CloudControlPlaneHandler, init_db # noqa: E402
|
||||||
|
|
||||||
|
|
||||||
def _handler(db_path):
|
def _handler(db_path):
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ from unittest import mock
|
|||||||
REPO_ROOT = Path(__file__).resolve().parents[2]
|
REPO_ROOT = Path(__file__).resolve().parents[2]
|
||||||
sys.path.insert(0, str(REPO_ROOT))
|
sys.path.insert(0, str(REPO_ROOT))
|
||||||
|
|
||||||
from cloud.server import init_db
|
from cloud.server import init_db # noqa: E402
|
||||||
from cloud.worker import Worker, _code_signature
|
from cloud.worker import Worker, _code_signature # noqa: E402
|
||||||
|
|
||||||
FAKE_ENV = {"XCM_API_KEY": "test-placeholder"}
|
FAKE_ENV = {"XCM_API_KEY": "test-placeholder"}
|
||||||
|
|
||||||
@@ -155,7 +155,6 @@ class StepAndCheckpointTestCase(_Base):
|
|||||||
|
|
||||||
def test_checkpoint_mirror_loop_exception_swallowed(self):
|
def test_checkpoint_mirror_loop_exception_swallowed(self):
|
||||||
w = _worker(self.db_path)
|
w = _worker(self.db_path)
|
||||||
calls = []
|
|
||||||
w._mirror_checkpoint_once = lambda task: (_ for _ in ()).throw(
|
w._mirror_checkpoint_once = lambda task: (_ for _ in ()).throw(
|
||||||
RuntimeError("mirror down"))
|
RuntimeError("mirror down"))
|
||||||
class _Stop:
|
class _Stop:
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ from unittest import mock
|
|||||||
REPO_ROOT = Path(__file__).resolve().parents[2]
|
REPO_ROOT = Path(__file__).resolve().parents[2]
|
||||||
sys.path.insert(0, str(REPO_ROOT))
|
sys.path.insert(0, str(REPO_ROOT))
|
||||||
|
|
||||||
from cloud.server import init_db
|
from cloud.server import init_db # noqa: E402
|
||||||
from cloud.worker import Worker
|
from cloud.worker import Worker # noqa: E402
|
||||||
|
|
||||||
FAKE_ENV = {"XCM_API_KEY": "test-placeholder"}
|
FAKE_ENV = {"XCM_API_KEY": "test-placeholder"}
|
||||||
|
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ from unittest import mock
|
|||||||
REPO_ROOT = Path(__file__).resolve().parents[2]
|
REPO_ROOT = Path(__file__).resolve().parents[2]
|
||||||
sys.path.insert(0, str(REPO_ROOT))
|
sys.path.insert(0, str(REPO_ROOT))
|
||||||
|
|
||||||
from cloud.server import init_db
|
from cloud.server import init_db # noqa: E402
|
||||||
from cloud.worker import Worker
|
from cloud.worker import Worker # noqa: E402
|
||||||
|
|
||||||
FAKE_ENV = {"XCM_API_KEY": "test-placeholder"}
|
FAKE_ENV = {"XCM_API_KEY": "test-placeholder"}
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ from unittest import mock
|
|||||||
REPO_ROOT = Path(__file__).resolve().parents[2]
|
REPO_ROOT = Path(__file__).resolve().parents[2]
|
||||||
sys.path.insert(0, str(REPO_ROOT))
|
sys.path.insert(0, str(REPO_ROOT))
|
||||||
|
|
||||||
from cloud import server as server_mod
|
from cloud import server as server_mod # noqa: E402
|
||||||
from cloud.ledger_outbox import replay_failures
|
from cloud.ledger_outbox import replay_failures # noqa: E402
|
||||||
|
|
||||||
|
|
||||||
class DispatchSafeTestCase(unittest.TestCase):
|
class DispatchSafeTestCase(unittest.TestCase):
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ from unittest import mock
|
|||||||
REPO_ROOT = Path(__file__).resolve().parents[2]
|
REPO_ROOT = Path(__file__).resolve().parents[2]
|
||||||
sys.path.insert(0, str(REPO_ROOT))
|
sys.path.insert(0, str(REPO_ROOT))
|
||||||
|
|
||||||
from cloud.marker_tools import (
|
from cloud.marker_tools import ( # noqa: E402
|
||||||
_as_int,
|
_as_int,
|
||||||
_heartbeat_age_text,
|
_heartbeat_age_text,
|
||||||
_model_from_match,
|
_model_from_match,
|
||||||
|
|||||||
@@ -16,12 +16,10 @@ and emit-failure logic under test stays real).
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import io
|
import io
|
||||||
import json
|
|
||||||
import os
|
import os
|
||||||
import sqlite3
|
import sqlite3
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
import time
|
|
||||||
import unittest
|
import unittest
|
||||||
import urllib.error
|
import urllib.error
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@@ -31,9 +29,9 @@ from unittest import mock
|
|||||||
REPO_ROOT = Path(__file__).resolve().parents[2]
|
REPO_ROOT = Path(__file__).resolve().parents[2]
|
||||||
sys.path.insert(0, str(REPO_ROOT))
|
sys.path.insert(0, str(REPO_ROOT))
|
||||||
|
|
||||||
import cloud.server as server_mod
|
import cloud.server as server_mod # noqa: E402
|
||||||
from cloud.handler_fullauto import FullAutoError, _full_auto_branch_protection_ok, _full_auto_github_request
|
from cloud.handler_fullauto import FullAutoError, _full_auto_branch_protection_ok, _full_auto_github_request # noqa: E402
|
||||||
from cloud.server import (
|
from cloud.server import ( # noqa: E402
|
||||||
CloudControlPlaneHandler,
|
CloudControlPlaneHandler,
|
||||||
init_db,
|
init_db,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ logic -- validation, permission checks via the real AuthStore,
|
|||||||
quota gates, driver result shaping -- runs for real.
|
quota gates, driver result shaping -- runs for real.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
|
||||||
import os
|
import os
|
||||||
import sqlite3
|
import sqlite3
|
||||||
import sys
|
import sys
|
||||||
@@ -33,9 +32,9 @@ from unittest import mock
|
|||||||
REPO_ROOT = Path(__file__).resolve().parents[2]
|
REPO_ROOT = Path(__file__).resolve().parents[2]
|
||||||
sys.path.insert(0, str(REPO_ROOT))
|
sys.path.insert(0, str(REPO_ROOT))
|
||||||
|
|
||||||
import cloud.server as server_mod
|
import cloud.server as server_mod # noqa: E402
|
||||||
from cloud.server import CloudControlPlaneHandler, _auth_store, init_db
|
from cloud.server import CloudControlPlaneHandler, _auth_store, init_db # noqa: E402
|
||||||
from cloud.sub2api import Sub2apiError as _Sub2apiError
|
from cloud.sub2api import Sub2apiError as _Sub2apiError # noqa: E402
|
||||||
|
|
||||||
|
|
||||||
def _handler(db_path, upload_dir=None):
|
def _handler(db_path, upload_dir=None):
|
||||||
|
|||||||
@@ -29,13 +29,12 @@ from unittest import mock
|
|||||||
REPO_ROOT = Path(__file__).resolve().parents[2]
|
REPO_ROOT = Path(__file__).resolve().parents[2]
|
||||||
sys.path.insert(0, str(REPO_ROOT))
|
sys.path.insert(0, str(REPO_ROOT))
|
||||||
|
|
||||||
import cloud.server as server_mod
|
from cloud.server import ( # noqa: E402
|
||||||
from cloud.server import (
|
|
||||||
CloudControlPlaneHandler,
|
CloudControlPlaneHandler,
|
||||||
_auth_store,
|
_auth_store,
|
||||||
init_db,
|
init_db,
|
||||||
)
|
)
|
||||||
from cloud.sub2api import Sub2apiError as _Sub2apiError
|
from cloud.sub2api import Sub2apiError as _Sub2apiError # noqa: E402
|
||||||
|
|
||||||
|
|
||||||
def _handler(db_path, upload_dir=None):
|
def _handler(db_path, upload_dir=None):
|
||||||
@@ -459,7 +458,6 @@ class TodosAutomationLoopTestCase(_Base):
|
|||||||
self._project()
|
self._project()
|
||||||
self._task()
|
self._task()
|
||||||
from cloud.audit_loop_wiring import (
|
from cloud.audit_loop_wiring import (
|
||||||
ensure_loop_state_table,
|
|
||||||
save_loop_state,
|
save_loop_state,
|
||||||
)
|
)
|
||||||
from cloud.audit_loop_driver import LoopState
|
from cloud.audit_loop_driver import LoopState
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ from unittest import mock
|
|||||||
REPO_ROOT = Path(__file__).resolve().parents[2]
|
REPO_ROOT = Path(__file__).resolve().parents[2]
|
||||||
sys.path.insert(0, str(REPO_ROOT))
|
sys.path.insert(0, str(REPO_ROOT))
|
||||||
|
|
||||||
from cloud.server import (
|
from cloud.server import ( # noqa: E402
|
||||||
CloudControlPlaneHandler,
|
CloudControlPlaneHandler,
|
||||||
_auth_store,
|
_auth_store,
|
||||||
init_db,
|
init_db,
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ stubbed only to drive the handler's own error mapping.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import socket
|
|
||||||
import sqlite3
|
import sqlite3
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
@@ -21,12 +20,11 @@ from unittest import mock
|
|||||||
REPO_ROOT = Path(__file__).resolve().parents[2]
|
REPO_ROOT = Path(__file__).resolve().parents[2]
|
||||||
sys.path.insert(0, str(REPO_ROOT))
|
sys.path.insert(0, str(REPO_ROOT))
|
||||||
|
|
||||||
from cloud.server import (
|
from cloud.server import ( # noqa: E402
|
||||||
CloudControlPlaneHandler,
|
CloudControlPlaneHandler,
|
||||||
_auth_store,
|
_auth_store,
|
||||||
init_db,
|
init_db,
|
||||||
)
|
)
|
||||||
from cloud.sub2api import Sub2apiError as _Sub2apiError
|
|
||||||
|
|
||||||
|
|
||||||
def _handler(db_path, upload_dir=None, tenants_root=None):
|
def _handler(db_path, upload_dir=None, tenants_root=None):
|
||||||
|
|||||||
@@ -23,14 +23,14 @@ from unittest import mock
|
|||||||
REPO_ROOT = Path(__file__).resolve().parents[2]
|
REPO_ROOT = Path(__file__).resolve().parents[2]
|
||||||
sys.path.insert(0, str(REPO_ROOT))
|
sys.path.insert(0, str(REPO_ROOT))
|
||||||
|
|
||||||
from cloud.server import (
|
from cloud.server import ( # noqa: E402
|
||||||
CloudControlPlaneHandler,
|
CloudControlPlaneHandler,
|
||||||
_auth_store,
|
_auth_store,
|
||||||
init_db,
|
init_db,
|
||||||
)
|
)
|
||||||
from cloud.full_auto import FullAutoError
|
from cloud.full_auto import FullAutoError # noqa: E402
|
||||||
from cloud.oauth import BindError
|
from cloud.oauth import BindError # noqa: E402
|
||||||
from cloud.wait_ops import create_handoff as _handoff_create
|
from cloud.wait_ops import create_handoff as _handoff_create # noqa: E402
|
||||||
|
|
||||||
|
|
||||||
def _handler(db_path, upload_dir=None, tenants_root=None):
|
def _handler(db_path, upload_dir=None, tenants_root=None):
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ from unittest import mock
|
|||||||
REPO_ROOT = Path(__file__).resolve().parents[2]
|
REPO_ROOT = Path(__file__).resolve().parents[2]
|
||||||
sys.path.insert(0, str(REPO_ROOT))
|
sys.path.insert(0, str(REPO_ROOT))
|
||||||
|
|
||||||
from cloud.handler_fullauto import _full_auto_installation_verified, _full_auto_parse_plan_params
|
from cloud.handler_fullauto import _full_auto_installation_verified, _full_auto_parse_plan_params # noqa: E402
|
||||||
from cloud.server import (
|
from cloud.server import ( # noqa: E402
|
||||||
CloudControlPlaneHandler,
|
CloudControlPlaneHandler,
|
||||||
RateLimiter,
|
RateLimiter,
|
||||||
_apply_default_quota,
|
_apply_default_quota,
|
||||||
@@ -47,7 +47,7 @@ from cloud.server import (
|
|||||||
sweep_rate_limit_hits,
|
sweep_rate_limit_hits,
|
||||||
DbRateLimiter,
|
DbRateLimiter,
|
||||||
)
|
)
|
||||||
from cloud.server import _auth_store as _auth_store_cm
|
from cloud.server import _auth_store as _auth_store_cm # noqa: E402
|
||||||
|
|
||||||
|
|
||||||
def _handler(db_path, upload_dir=None, tenants_root=None):
|
def _handler(db_path, upload_dir=None, tenants_root=None):
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ from unittest import mock
|
|||||||
REPO_ROOT = Path(__file__).resolve().parents[2]
|
REPO_ROOT = Path(__file__).resolve().parents[2]
|
||||||
sys.path.insert(0, str(REPO_ROOT))
|
sys.path.insert(0, str(REPO_ROOT))
|
||||||
|
|
||||||
from cloud.server import (
|
from cloud.server import ( # noqa: E402
|
||||||
CloudControlPlaneHandler,
|
CloudControlPlaneHandler,
|
||||||
init_db,
|
init_db,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ plus small variants that trip each loud-failure branch.
|
|||||||
import contextlib
|
import contextlib
|
||||||
import importlib.util
|
import importlib.util
|
||||||
import io
|
import io
|
||||||
import sys
|
|
||||||
import tempfile
|
import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ from unittest import mock
|
|||||||
REPO_ROOT = Path(__file__).resolve().parents[2]
|
REPO_ROOT = Path(__file__).resolve().parents[2]
|
||||||
sys.path.insert(0, str(REPO_ROOT))
|
sys.path.insert(0, str(REPO_ROOT))
|
||||||
|
|
||||||
from cloud.wait_ops import (
|
from cloud.wait_ops import ( # noqa: E402
|
||||||
_normalize_json_checks,
|
_normalize_json_checks,
|
||||||
_row_dict,
|
_row_dict,
|
||||||
build_pr_diagnostics,
|
build_pr_diagnostics,
|
||||||
@@ -189,10 +189,11 @@ class WaitCoresTestCase(unittest.TestCase):
|
|||||||
self.assertEqual((task_id, kind), ("t1", "needs_continue"))
|
self.assertEqual((task_id, kind), ("t1", "needs_continue"))
|
||||||
|
|
||||||
def test_poll_first_bad_timeout_immediate(self):
|
def test_poll_first_bad_timeout_immediate(self):
|
||||||
fetch = lambda: {"t1": {"status": "completed",
|
def fetch():
|
||||||
"pending_approvals": 0,
|
return {"t1": {"status": "completed",
|
||||||
"pending_input": 0,
|
"pending_approvals": 0,
|
||||||
"pending_followups": 0}}
|
"pending_input": 0,
|
||||||
|
"pending_followups": 0}}
|
||||||
changed, summaries, waited, timed_out = poll_for_first_change(
|
changed, summaries, waited, timed_out = poll_for_first_change(
|
||||||
fetch, ["t1"], timeout_seconds="bad")
|
fetch, ["t1"], timeout_seconds="bad")
|
||||||
self.assertEqual(changed["kind"], "terminal")
|
self.assertEqual(changed["kind"], "terminal")
|
||||||
@@ -204,7 +205,8 @@ class WaitCoresTestCase(unittest.TestCase):
|
|||||||
{"t1": {"status": "completed", "pending_approvals": 0,
|
{"t1": {"status": "completed", "pending_approvals": 0,
|
||||||
"pending_input": 0, "pending_followups": 0}}]
|
"pending_input": 0, "pending_followups": 0}}]
|
||||||
it = iter(seq)
|
it = iter(seq)
|
||||||
fetch = lambda: next(it, seq[-1])
|
def fetch():
|
||||||
|
return next(it, seq[-1])
|
||||||
changed, summaries, waited, timed_out = poll_for_first_change(
|
changed, summaries, waited, timed_out = poll_for_first_change(
|
||||||
fetch, ["t1"], timeout_seconds=5, poll_seconds=0.01)
|
fetch, ["t1"], timeout_seconds=5, poll_seconds=0.01)
|
||||||
self.assertEqual(changed["kind"], "terminal")
|
self.assertEqual(changed["kind"], "terminal")
|
||||||
|
|||||||
@@ -36,9 +36,9 @@ from unittest import mock
|
|||||||
REPO_ROOT = Path(__file__).resolve().parents[2]
|
REPO_ROOT = Path(__file__).resolve().parents[2]
|
||||||
sys.path.insert(0, str(REPO_ROOT))
|
sys.path.insert(0, str(REPO_ROOT))
|
||||||
|
|
||||||
from cloud.server import init_db
|
from cloud.server import init_db # noqa: E402
|
||||||
from cloud.todos import create_todo as _create_todo
|
from cloud.todos import create_todo as _create_todo # noqa: E402
|
||||||
from cloud.worker import Worker
|
from cloud.worker import Worker # noqa: E402
|
||||||
|
|
||||||
FAKE_ENV = {"XCM_API_KEY": "test-placeholder"}
|
FAKE_ENV = {"XCM_API_KEY": "test-placeholder"}
|
||||||
|
|
||||||
@@ -283,7 +283,6 @@ class ControlFallbackTestCase(DeliverBase):
|
|||||||
def test_retry_not_done_when_rowcount_zero(self):
|
def test_retry_not_done_when_rowcount_zero(self):
|
||||||
self._insert("E1", status="failed", parent="PM")
|
self._insert("E1", status="failed", parent="PM")
|
||||||
worker = self._worker()
|
worker = self._worker()
|
||||||
real_connect = sqlite3.connect
|
|
||||||
|
|
||||||
class _CursorProxy:
|
class _CursorProxy:
|
||||||
def __init__(self, real):
|
def __init__(self, real):
|
||||||
|
|||||||
Reference in new issue
Block a user