From ddefb037019ff3e1a9f967c87c606bff490c36dd Mon Sep 17 00:00:00 2001 From: Chris Coutinho Date: Mon, 8 Jun 2026 02:00:24 +0200 Subject: [PATCH] test(usage): mark new gateway usage tests with @pytest.mark.unit (round 6) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Round-6 claude-review (ready to merge): the three new GatewayProvider usage/bearer tests lacked @pytest.mark.unit, so `pytest -m unit` skipped them even though every other new test in this PR is marked. Add the marker to the three new tests (leaving the pre-existing unmarked tests in the file alone). Remaining 🟢 items (OpenAI embed() dual path, recursion-invariant runtime enforcement, Bedrock sync-in-async) are acknowledged deferrals — separate refactors, unchanged. Deck #67. Co-Authored-By: Claude Opus 4.8 (1M context) --- tests/unit/providers/test_gateway_provider.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/unit/providers/test_gateway_provider.py b/tests/unit/providers/test_gateway_provider.py index e7f5ad95..45f798a8 100644 --- a/tests/unit/providers/test_gateway_provider.py +++ b/tests/unit/providers/test_gateway_provider.py @@ -328,6 +328,7 @@ def test_trailing_slash_base_url_normalized(): assert not base.endswith("/v1/v1") +@pytest.mark.unit async def test_gateway_embed_with_usage_forwards_after_bearer(monkeypatch): """embed_with_usage refreshes the bearer, then returns the (embedding, token_count) from the inherited OpenAI implementation.""" @@ -363,6 +364,7 @@ async def test_gateway_embed_with_usage_forwards_after_bearer(monkeypatch): assert order == ["bearer", "embed"] # bearer refreshed before the embed call +@pytest.mark.unit async def test_gateway_embed_batch_with_usage_forwards_after_bearer(monkeypatch): """embed_batch_with_usage also refreshes the bearer before delegating.""" # https mock host (never contacted — the OpenAI client is patched below). @@ -393,6 +395,7 @@ async def test_gateway_embed_batch_with_usage_forwards_after_bearer(monkeypatch) assert ensured["n"] == 1 +@pytest.mark.unit async def test_gateway_embed_batch_ensures_bearer_once(monkeypatch): """embed_batch() has no override: it routes through the inherited OpenAI embed_batch() → embed_batch_with_usage() (overridden), so the bearer is