Skip to content

The agent that grows with you

test: collecting a Bedrock test no longer pip-installs boto3 mid-run

teknium1a5c389e16dc7
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 46ccae2f634..25ad2f412e2 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -80,14 +80,14 @@ jobs:
# The trailing extras beyond all/dev are the lazy-install features
# (tools/lazy_deps.py) that tests exercise for real: provider.anthropic,
# stt/tts.mistral, image.fal, terminal.modal, terminal.daytona,
- # search.parallel. The hermetic test env forbids
+ # search.parallel, provider.bedrock. The hermetic test env forbids
# mid-run pip installs (HERMES_DISABLE_LAZY_INSTALLS=1 in
# tests/conftest.py), so the SDKs those tests need must be in the
# venv up front — resolved from uv.lock like everything else, which
# also honors the exact supply-chain pins these extras carry.
uses: ./.github/actions/retry
with:
- command: uv sync --locked --python 3.11 --extra all --extra dev --extra anthropic --extra mistral --extra fal --extra modal --extra daytona --extra parallel-web
+ command: uv sync --locked --python 3.11 --extra all --extra dev --extra anthropic --extra mistral --extra fal --extra modal --extra daytona --extra parallel-web --extra bedrock
- name: Minimize uv cache
# Optimized for CI: prunes pre-built wheels that are cheap to
@@ -235,7 +235,7 @@ jobs:
# in the venv up front.
uses: ./.github/actions/retry
with:
- command: uv sync --locked --python 3.11.15 --extra all --extra dev --extra anthropic --extra mistral --extra fal --extra modal --extra daytona --extra parallel-web
+ command: uv sync --locked --python 3.11.15 --extra all --extra dev --extra anthropic --extra mistral --extra fal --extra modal --extra daytona --extra parallel-web --extra bedrock
- name: Minimize uv cache
# Optimized for CI: prunes pre-built wheels that are cheap to
diff --git a/tests/agent/test_bedrock_adapter.py b/tests/agent/test_bedrock_adapter.py
index a10c3b345f0..1d725b856fe 100644
--- a/tests/agent/test_bedrock_adapter.py
+++ b/tests/agent/test_bedrock_adapter.py
@@ -1569,6 +1569,7 @@ class TestReasoningReplaySchema:
replaying captured thinking as a bare ``text`` key dies client-side with ParamValidationError (#115865)."""
def test_call_converse_replays_thinking_botocore_accepts(self):
+ pytest.importorskip("botocore.session", reason="botocore (bedrock extra) required")
import botocore.session
from botocore.validate import validate_parameters
from agent.bedrock_adapter import call_converse
diff --git a/tests/conftest.py b/tests/conftest.py
index cf4292e9032..21cbeb9679c 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -112,6 +112,13 @@ if _hermes_home_points_at_production(os.environ.get("HERMES_HOME", "")):
# env instead of stripping markers.
os.environ["HERMES_TEST_ISOLATION"] = os.environ.get("HERMES_HOME", "") or "1"
+# Lazy-install kill-switch, set before any test module is imported. The per-test
+# fixture below sets it too, but collection runs first: agent/bedrock_adapter.py
+# calls lazy_deps.ensure() at import time, so collecting a file that imports it
+# ran a real `uv pip install boto3` into the shared venv while other files raced
+# on whether botocore was importable yet.
+os.environ["HERMES_DISABLE_LAZY_INSTALLS"] = "1"
+
#: HERMES_HOME as it stood when conftest was imported - i.e. before any test
#: module could import code that configures logging. Recorded so the guard in
#: tests/test_log_isolation.py can assert the sandbox existed AT THAT MOMENT.
diff --git a/tests/tools/test_lazy_deps.py b/tests/tools/test_lazy_deps.py
index af177e1b453..11bd8d1a783 100644
--- a/tests/tools/test_lazy_deps.py
+++ b/tests/tools/test_lazy_deps.py
@@ -13,10 +13,21 @@ call is mocked — we never actually shell out during unit tests.
from __future__ import annotations
+import os
+
import pytest
import tools.lazy_deps as ld
+# Read while pytest imports this module, i.e. at collection, before any fixture runs.
+_KILL_SWITCH_AT_COLLECTION = os.environ.get("HERMES_DISABLE_LAZY_INSTALLS")
+
+
+def test_lazy_installs_are_disabled_during_collection():
+ """Modules can call ensure() at import time (agent/bedrock_adapter.py does), so the
+ kill-switch must already be set when test modules are collected, not only per test."""
+ assert _KILL_SWITCH_AT_COLLECTION == "1"
+
# ---------------------------------------------------------------------------
# Spec safety