Files
hermes-agent/tests/workspace/test_plugin_integration.py
T
alt-glitch 4921bad61f style(workspace): remove __future__ annotations, fix ty diagnostics
- Remove `from __future__ import annotations` from all new workspace files
- Convert TYPE_CHECKING imports to real imports in base.py (no circular deps)
- Quote self-referential forward ref in config.py model_validator
- Add null checks on spec.loader in plugin discovery to satisfy ty
2026-04-18 15:58:54 +05:30

51 lines
1.5 KiB
Python

"""End-to-end integration tests for workspace plugin architecture."""
from workspace import get_indexer
from workspace.base import BaseIndexer
from workspace.config import WorkspaceConfig
from workspace.default import DefaultIndexer
def test_get_indexer_returns_default_when_not_configured(make_workspace_config):
cfg = make_workspace_config()
indexer = get_indexer(cfg)
assert isinstance(indexer, DefaultIndexer)
assert isinstance(indexer, BaseIndexer)
def test_get_indexer_falls_back_on_unknown_plugin(make_workspace_config):
cfg = make_workspace_config()
cfg = WorkspaceConfig(
workspace_root=cfg.workspace_root,
indexer="nonexistent_xyz",
)
indexer = get_indexer(cfg)
assert isinstance(indexer, DefaultIndexer)
def test_full_round_trip_through_factory(make_workspace_config, write_file):
cfg = make_workspace_config()
write_file(
cfg.workspace_root / "docs" / "test.md", "# Test\n\nSearchable content here.\n"
)
indexer = get_indexer(cfg)
summary = indexer.index()
assert summary.files_indexed == 1
results = indexer.search("searchable")
assert len(results) > 0
assert results[0].path.endswith("test.md")
def test_status_works_through_factory(make_workspace_config, write_file):
cfg = make_workspace_config()
write_file(cfg.workspace_root / "docs" / "a.md", "# A\n\nContent.\n")
indexer = get_indexer(cfg)
indexer.index()
status = indexer.status()
assert status["file_count"] >= 1
assert status["chunk_count"] >= 1