Merge pull request #2745 from Molecule-AI/fix/harness-stub-auth-headers-1arg

fix(harness): stub platform_auth with *args lambdas (#2743 fallout)
This commit is contained in:
Hongming Wang 2026-05-04 15:58:24 +00:00 committed by GitHub
commit 3886e8fb9f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -75,9 +75,14 @@ from unittest.mock import AsyncMock, MagicMock, patch
# Stub platform_auth so a2a_client imports cleanly without requiring a
# real workspace token file. The helper's auth_headers() only matters
# when going through the network; we're feeding it a mock response.
#
# Both stubs accept *args, **kwargs because the multi-workspace work
# (#2739, #2743) added optional ``workspace_id`` parameters to
# ``auth_headers`` and made ``self_source_headers`` 1-arg-required.
# The stubs need to accept whatever the helpers pass without caring.
_pa = types.ModuleType("platform_auth")
_pa.auth_headers = lambda: {}
_pa.self_source_headers = lambda: {}
_pa.auth_headers = lambda *a, **kw: {}
_pa.self_source_headers = lambda *a, **kw: {}
sys.modules.setdefault("platform_auth", _pa)
sys.path.insert(0, sys.argv[1])