molecule-core/plugins/molecule-medo/tests/conftest.py
molecule-ai[bot] 487a4e08ff refactor(#741): extract medo.py from builtin_tools to plugins/molecule-medo
The Baidu MeDo hackathon integration was sitting in builtin_tools/ as dead
code — not imported by any loader but shipped with every workspace image,
misleadingly suggesting it was a core builtin.

Changes:
- Move builtin_tools/medo.py → plugins/molecule-medo/skills/medo-tools/scripts/medo.py
  (git detects this as a rename — no code changes, identical tool surface)
- Add plugins/molecule-medo/plugin.yaml (manifest: name, version, runtimes, tags)
- Add plugins/molecule-medo/skills/medo-tools/SKILL.md (frontmatter + setup docs)
- Move workspace-template/tests/test_medo.py → plugins/molecule-medo/tests/test_medo.py
  (update _MEDO_PATH to resolve from plugin root; add conftest.py for langchain mock)
- Update .gitignore: change /plugins/ blanket ignore to /plugins/* so this plugin
  can be tracked until it gets its own standalone repo

Acceptance criteria met:
- builtin_tools/medo.py removed from core
- plugins/molecule-medo/ created with identical tool surface (9/9 tests pass)
- cd workspace-template && pytest → 1021 passed, 2 xfailed (no regression)
- MEDO_API_KEY was never in default provisioning (.env.example / config.py clean)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-17 16:03:50 +00:00

22 lines
722 B
Python

"""Minimal conftest for molecule-medo plugin tests.
langchain_core is a declared dependency of workspace-template (>=0.3.0) and
is expected to be present in the test environment. If it is absent, mock it
so the @tool decorator in medo.py is a no-op and the tests can still run.
"""
import sys
from types import ModuleType
def _mock_langchain_if_missing():
if "langchain_core" not in sys.modules:
lc_mod = ModuleType("langchain_core")
lc_tools_mod = ModuleType("langchain_core.tools")
lc_tools_mod.tool = lambda f: f # @tool becomes identity decorator
sys.modules["langchain_core"] = lc_mod
sys.modules["langchain_core.tools"] = lc_tools_mod
_mock_langchain_if_missing()