molecule-core/workspace
Molecule AI Core-BE 76ac5a88dc [core-be-agent]
fix(tests): clear platform_auth cache before each test

Fixes issue #160: workspace tests fail when MOLECULE_WORKSPACE_TOKEN
is set in the environment.

The bug: platform_auth._cached_token is populated at module import or
first get_token() call and persists for the process lifetime. Tests
that use monkeypatch.delenv("MOLECULE_WORKSPACE_TOKEN") to simulate "no
token in env" were failing because delenv removes the env var but not
the module-level cache — subsequent get_token() calls returned the
stale cached value.

Fix: add a function-scoped autouse fixture in conftest.py that calls
platform_auth.clear_cache() before every test. The import is inside the
fixture to avoid collection-time import issues when platform_auth is
not yet available.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-09 22:16:11 +00:00
..
adapters
builtin_tools
lib
molecule_audit
platform_tools
plugins_registry
policies
scripts
skill_loader
tests [core-be-agent] 2026-05-09 22:16:11 +00:00
.coveragerc
a2a_cli.py
a2a_client.py
a2a_executor.py
a2a_mcp_server.py
a2a_response.py
a2a_tools_delegation.py
a2a_tools_inbox.py
a2a_tools_memory.py
a2a_tools_messaging.py
a2a_tools_rbac.py
a2a_tools.py
adapter_base.py
agent.py
agents_md.py
boot_routes.py
build-all.sh
card_helpers.py
config.py
configs_dir.py
consolidation.py
coordinator.py
Dockerfile
entrypoint.sh
event_log.py
events.py
executor_helpers.py
heartbeat.py
inbox_uploads.py
inbox.py
initial_prompt.py
internal_chat_uploads.py
internal_file_read.py
main.py tech-debt: rename molecule-monorepo-net -> molecule-core-net 2026-05-09 20:51:48 +00:00
mcp_cli.py
mcp_doctor.py
mcp_heartbeat.py
mcp_inbox_pollers.py
mcp_workspace_resolver.py
molecule_ai_status.py
not_configured_handler.py
platform_auth.py
platform_inbound_auth.py
plugins.py
preflight.py
prompt.py
pytest.ini
rebuild-runtime-images.sh
requirements.txt
runtime_wedge.py
secret_redactor.py
shared_runtime.py
smoke_mode.py
transcript_auth.py
watcher.py