test: fix WORKSPACE_ID assert to match module attr (CI portability)
CI's pytest harness pre-sets WORKSPACE_ID=test in the env before
test collection, so a2a_client's module-level WORKSPACE_ID
(captured at import time, line 24) holds "test" — but the local
fixture's monkeypatch.setenv("WORKSPACE_ID", ...) only affects the
ENV value seen on later os.environ reads, NOT the already-bound
module attribute.
Assert against a2a_client.WORKSPACE_ID directly so the test is
portable across local + CI runs without monkey-patching the module
itself (which a future test reload might undo).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
1161b97faf
commit
35b3ea598a
@ -112,8 +112,11 @@ class TestDiscoverPeerSourceRouting:
|
||||
monkeypatch.setattr(a2a_client.httpx, "AsyncClient", lambda timeout: _Client())
|
||||
|
||||
await a2a_client.discover_peer("11111111-1111-1111-1111-111111111111")
|
||||
# Falls back to the env-var WORKSPACE_ID set in _isolate_env.
|
||||
assert captured["headers"]["X-Workspace-ID"] == "00000000-0000-0000-0000-000000000001"
|
||||
# WORKSPACE_ID is captured at a2a_client import time; assert
|
||||
# against the module attribute rather than a hardcoded UUID so
|
||||
# the test is portable across CI environments that pre-set
|
||||
# WORKSPACE_ID before pytest runs.
|
||||
assert captured["headers"]["X-Workspace-ID"] == a2a_client.WORKSPACE_ID
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_invalid_target_id_returns_none_without_routing(self, monkeypatch):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user