Skip to content

Commit 5edfe0c

Browse files
copilot feedback
1 parent 7c92e5d commit 5edfe0c

7 files changed

Lines changed: 35 additions & 11 deletions

File tree

.github/workflows/ci.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,16 @@ jobs:
118118
uses: actions/cache@v4
119119
with:
120120
path: ~/.holoviz-mcp-test
121-
key: holoviz-mcp-test-index-${{ runner.os }}-${{ hashFiles('src/holoviz_mcp/config/config.yaml') }}-${{ steps.cache-week.outputs.week }}
121+
key: holoviz-mcp-test-index-${{ runner.os }}-${{ hashFiles('src/holoviz_mcp/config/config.yaml', 'src/holoviz_mcp/holoviz_mcp/data.py') }}-${{ steps.cache-week.outputs.week }}
122122
restore-keys: |
123-
holoviz-mcp-test-index-${{ runner.os }}-${{ hashFiles('src/holoviz_mcp/config/config.yaml') }}-
123+
holoviz-mcp-test-index-${{ runner.os }}-${{ hashFiles('src/holoviz_mcp/config/config.yaml', 'src/holoviz_mcp/holoviz_mcp/data.py') }}-
124124
holoviz-mcp-test-index-${{ runner.os }}-
125125
- name: Install repository
126126
run: pixi run -e ${{ matrix.environment }} postinstall
127-
- name: Run pytest
128-
run: pixi run -e ${{ matrix.environment }} test-coverage --color=yes
127+
- name: Run unit tests (fast)
128+
run: pixi run -e ${{ matrix.environment }} pytest tests/ --ignore=tests/docs_mcp --color=yes
129+
- name: Run docs integration tests (slow, uses cached index)
130+
run: pixi run -e ${{ matrix.environment }} pytest tests/docs_mcp --color=yes
129131

130132
pytest_ui:
131133
name: ui:${{ matrix.environment }}:${{ matrix.os }}

AGENTS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ A README for AI coding agents to effectively contribute to the HoloViz MCP proje
1111
**Language**: Python 3.11+
1212
**Build System**: Pixi (conda-based) + Hatchling (PEP 517)
1313
**Framework**: FastMCP (Python MCP SDK)
14-
**Key Dependencies**: ChromaDB, sentence-transformers, Panel, PyTorch
14+
**Key Dependencies**: ChromaDB, sentence-transformers, Panel
1515

1616
### Project Statistics
1717
- **Source Files**: ~20 Python modules in `src/holoviz_mcp/`
@@ -564,7 +564,7 @@ First-time indexing takes 5-10 minutes:
564564

565565
### Memory Usage
566566

567-
Heavy dependencies (PyTorch, sentence-transformers):
567+
Heavy dependencies (sentence-transformers, ChromaDB):
568568
- **Development**: ~2-4 GB RAM
569569
- **Running server**: ~1-2 GB RAM
570570
- **Indexing docs**: ~3-5 GB RAM (temporary spike)

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ filterwarnings = [
176176
"ignore::UserWarning",
177177
]
178178
testpaths = ["tests"]
179+
markers = [
180+
"integration: marks tests that require the documentation index (slow)",
181+
]
179182

180183
[tool.codespell]
181184
ignore-words-list = "acn"

tests/docs_mcp/conftest.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import asyncio
99
import logging
10+
import os
1011
from pathlib import Path
1112

1213
import pytest
@@ -16,8 +17,9 @@
1617

1718
logger = logging.getLogger(__name__)
1819

19-
# Fixed test directory (not tmp_path) so CI can cache the index across runs
20-
TEST_DATA_DIR = Path.home() / ".holoviz-mcp-test"
20+
# Fixed test directory (not tmp_path) so CI can cache the index across runs.
21+
# Override with HOLOVIZ_MCP_TEST_DIR for custom locations or concurrent sessions.
22+
TEST_DATA_DIR = Path(os.environ["HOLOVIZ_MCP_TEST_DIR"]) if "HOLOVIZ_MCP_TEST_DIR" in os.environ else Path.home() / ".holoviz-mcp-test"
2123

2224
# Only these projects are needed by test assertions
2325
TEST_PROJECTS = ("panel", "hvplot", "panel-material-ui")
@@ -31,8 +33,11 @@ def _build_test_config():
3133
loader = ConfigLoader(config=env)
3234
default_config = loader.load_config()
3335

34-
# Keep only the repos needed for tests
35-
test_repos = {name: default_config.docs.repositories[name] for name in TEST_PROJECTS if name in default_config.docs.repositories}
36+
# Validate that all expected test repos exist in the default config
37+
missing = set(TEST_PROJECTS) - set(default_config.docs.repositories)
38+
if missing:
39+
raise RuntimeError(f"TEST_PROJECTS not found in default config: {missing}")
40+
test_repos = {name: default_config.docs.repositories[name] for name in TEST_PROJECTS}
3641

3742
test_docs = default_config.docs.model_copy(update={"repositories": test_repos})
3843
test_server = default_config.server.model_copy(update={"vector_db_path": TEST_DATA_DIR / "vector_db" / "chroma"})
@@ -47,7 +52,7 @@ def _build_test_config():
4752
)
4853

4954

50-
@pytest.fixture(scope="session", autouse=True)
55+
@pytest.fixture(scope="package", autouse=True)
5156
def docs_test_config():
5257
"""Patch get_config() to use a minimal 3-repo test config for the session.
5358

tests/docs_mcp/test_docs_mcp.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ async def test_skills_resource():
1919
assert result.data
2020

2121

22+
@pytest.mark.integration
2223
@pytest.mark.skip(reason="this test is very slow")
2324
@pytest.mark.asyncio
2425
async def test_update_index():
@@ -29,6 +30,7 @@ async def test_update_index():
2930
assert result.data
3031

3132

33+
@pytest.mark.integration
3234
@pytest.mark.asyncio
3335
async def test_list_projects():
3436
"""Test that all projects are listed correctly."""
@@ -40,6 +42,7 @@ async def test_list_projects():
4042
assert "panel" in result.data
4143

4244

45+
@pytest.mark.integration
4346
@pytest.mark.asyncio
4447
async def test_semantic_search():
4548
"""Test the search tool."""
@@ -63,6 +66,7 @@ async def test_semantic_search():
6366
assert "content" in document
6467

6568

69+
@pytest.mark.integration
6670
@pytest.mark.asyncio
6771
async def test_search_by_project():
6872
"""Test the search tool with project filtering."""
@@ -78,6 +82,7 @@ async def test_search_by_project():
7882
assert document["project"] == "hvplot"
7983

8084

85+
@pytest.mark.integration
8186
@pytest.mark.asyncio
8287
async def test_search_with_custom_max_results():
8388
"""Test the search tool with custom max_results parameter."""
@@ -95,6 +100,7 @@ async def test_search_with_custom_max_results():
95100
assert document["project"] == "panel"
96101

97102

103+
@pytest.mark.integration
98104
@pytest.mark.asyncio
99105
async def test_search_without_content():
100106
"""Test the search tool with content=False for metadata only."""
@@ -116,6 +122,7 @@ async def test_search_without_content():
116122
assert document.get("content") is None
117123

118124

125+
@pytest.mark.integration
119126
@pytest.mark.asyncio
120127
async def test_search_material_ui_specific():
121128
"""Test the search tool with Material UI specific query."""
@@ -131,6 +138,7 @@ async def test_search_material_ui_specific():
131138
assert document["project"] == "panel-material-ui"
132139

133140

141+
@pytest.mark.integration
134142
@pytest.mark.asyncio
135143
async def test_search_empty_query():
136144
"""Test the search tool with edge cases."""
@@ -142,6 +150,7 @@ async def test_search_empty_query():
142150
assert isinstance(result.data, list)
143151

144152

153+
@pytest.mark.integration
145154
@pytest.mark.asyncio
146155
async def test_search_invalid_project():
147156
"""Test the search tool with invalid project name."""
@@ -154,6 +163,7 @@ async def test_search_invalid_project():
154163
assert len(result.data) == 0
155164

156165

166+
@pytest.mark.integration
157167
@pytest.mark.asyncio
158168
async def test_search_with_project_filter():
159169
"""Test the search tool with project filtering."""

tests/docs_mcp/test_docs_mcp_reference_guide.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
from holoviz_mcp.holoviz_mcp.server import mcp
1111

12+
pytestmark = pytest.mark.integration
13+
1214

1315
@pytest.mark.asyncio
1416
async def test_get_reference_guide_button_no_project():

tests/docs_mcp/test_tabulator_truncation.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
from holoviz_mcp.holoviz_mcp.data import DocumentationIndexer
1515
from holoviz_mcp.holoviz_mcp.data import truncate_content
1616

17+
pytestmark = pytest.mark.integration
18+
1719

1820
class TestTabulatorTruncation:
1921
"""Test suite for Tabulator reference guide context-aware truncation."""

0 commit comments

Comments
 (0)