Skip to content

Commit f26bf4f

Browse files
committed
Keep the test suite honest under tight runtime limits
Move the thread-limit skip from a global pytest hook into the two tests that actually need it, and tighten the telemetry dependency contract to the resolver-compatible floor so the lockfile stays reproducible. Constraint: sandboxed CI can limit threads and loopback binds, and google-adk 2.1.0 constrains opentelemetry-sdk to <=1.41.1. Rejected: global runtime skip hook | it suppresses unrelated regressions and makes suite behavior less trustworthy. Confidence: high Scope-risk: moderate Directive: prefer explicit per-test skips for environment-specific limits; keep optional dependency floors aligned with the resolver. Tested: uv lock; git diff --check; pytest tests/test_phase5_context_bus.py::TestContextBus::test_parallel_publish_from_threads tests/test_swarm.py::test_swarm_manager_execute_multiple tests/test_managed_runtime.py tests/test_telemetry.py -q Not-tested: full repository test suite
1 parent dc1ad17 commit f26bf4f

5 files changed

Lines changed: 564 additions & 32 deletions

File tree

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,15 @@ oauth = [
5555
"cryptography>=3.4",
5656
]
5757
managed-google-adk = [
58-
"google-adk",
58+
"google-adk>=2.0.0",
5959
]
6060
managed-vertex = [
6161
"google-cloud-aiplatform>=1.154.0",
6262
]
6363
telemetry = [
6464
"opentelemetry-api>=1.20",
6565
"opentelemetry-sdk>=1.20",
66-
"opentelemetry-exporter-otlp-proto-http>=1.42.1",
66+
"opentelemetry-exporter-otlp-proto-http>=1.41.1",
6767
]
6868
anthropic = [
6969
"anthropic>=0.40.0",
@@ -104,8 +104,8 @@ dev = [
104104
"tree-sitter-language-pack>=1.0.0",
105105
"opentelemetry-api>=1.20",
106106
"opentelemetry-sdk>=1.20",
107-
"opentelemetry-exporter-otlp-proto-http>=1.42.1",
108-
"google-adk",
107+
"opentelemetry-exporter-otlp-proto-http>=1.41.1",
108+
"google-adk>=2.0.0",
109109
"google-cloud-aiplatform>=1.154.0",
110110
]
111111

test_support.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22

33
import socket
4+
import threading
45

56
import pytest
67

@@ -16,8 +17,27 @@ def can_bind_loopback() -> bool:
1617
return True
1718

1819

20+
def can_start_thread() -> bool:
21+
thread = threading.Thread(target=lambda: None)
22+
try:
23+
thread.start()
24+
except RuntimeError as exc:
25+
if "can't start new thread" in str(exc):
26+
return False
27+
raise
28+
thread.join(timeout=1.0)
29+
return True
30+
31+
1932
def skip_if_socket_bind_is_blocked() -> None:
2033
"""Skip tests that require a loopback TCP listener when the environment forbids it."""
2134

2235
if not can_bind_loopback():
2336
pytest.skip('sandbox forbids socket.bind() on loopback')
37+
38+
39+
def skip_if_thread_start_is_blocked() -> None:
40+
"""Skip tests that require spawning worker threads when the environment forbids it."""
41+
42+
if not can_start_thread():
43+
pytest.skip('environment has thread resource limits')

tests/test_phase5_context_bus.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
DeltaCard,
1111
DeltaType,
1212
)
13+
from test_support import skip_if_thread_start_is_blocked
1314

1415

1516
class TestContextBus:
@@ -208,6 +209,7 @@ def test_cleanup_old_deltas_scoped_to_workflow(self):
208209

209210
def test_parallel_publish_from_threads(self):
210211
"""Concurrent publishes use per-thread SQLite connections."""
212+
skip_if_thread_start_is_blocked()
211213
with tempfile.TemporaryDirectory() as tmpdir:
212214
db_path = Path(tmpdir) / 'context_bus.db'
213215
config = ContextBusConfig(db_path=db_path, workflow_id='test-workflow')

tests/test_swarm.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
SwarmManager,
1919
SwarmReport,
2020
)
21+
from test_support import skip_if_thread_start_is_blocked
2122

2223

2324
def test_subagent_task_creation():
@@ -134,6 +135,7 @@ def test_swarm_manager_execute_empty():
134135

135136

136137
def test_swarm_manager_execute_multiple():
138+
skip_if_thread_start_is_blocked()
137139
with tempfile.TemporaryDirectory() as tmpdir:
138140
manager = SwarmManager(tmpdir, max_parallel=2)
139141

0 commit comments

Comments
 (0)