Skip to content

Commit df6f5cc

Browse files
Mark ALL indexing tests as slow - found 15 more in test_docs_mcp_reference_guide.py
Co-authored-by: MarcSkovMadsen <42288570+MarcSkovMadsen@users.noreply.github.com>
1 parent 937ada0 commit df6f5cc

2 files changed

Lines changed: 37 additions & 4 deletions

File tree

tests/docs_mcp/README.md

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@ These tests use a **minimal test configuration** (`config.yaml`) that only index
1616

1717
### Fast Tests (CI - Default)
1818
- `test_skills_resource`: Tests resource loading without requiring indexing
19+
- All tests in `test_data.py`: Unit tests for utility functions (don't require indexing)
1920

2021
### Slow Tests (Local Only)
2122
Tests marked with `@pytest.mark.slow` require indexing and are skipped in CI:
23+
24+
**From `test_docs_mcp.py` (9 tests):**
2225
- `test_update_index`: Full indexing test
2326
- `test_list_projects`: Lists indexed projects
2427
- `test_semantic_search`: Searches across indexed documentation
@@ -29,11 +32,16 @@ Tests marked with `@pytest.mark.slow` require indexing and are skipped in CI:
2932
- `test_search_invalid_project`: Tests error handling
3033
- `test_get_document`: Tests document retrieval
3134

35+
**From `test_docs_mcp_reference_guide.py` (15 tests):**
36+
- All 15 tests for the `get_reference_guide` tool
37+
- These test reference guide lookups across different projects and components
38+
- Each test triggers indexing to ensure reference guides are available
39+
3240
## Running Tests
3341

3442
### Fast Tests Only (Default in CI)
3543
```bash
36-
# Runs only non-slow tests
44+
# Runs only non-slow tests (1 fast test + 12 unit tests)
3745
pytest tests/docs_mcp/ -m "not slow"
3846
```
3947

@@ -64,10 +72,18 @@ Even with the minimal test configuration (1 repository, limited docs), the first
6472

6573
This is too slow for CI, so we mark these tests as `slow` and skip them in CI. The minimal configuration is still valuable for local development where you want to test the indexing functionality without waiting for all 12 repositories.
6674

75+
## Test Files
76+
77+
- `test_docs_mcp.py`: Core documentation server tests (search, list_projects, etc.)
78+
- `test_docs_mcp_reference_guide.py`: Comprehensive tests for `get_reference_guide` tool
79+
- `test_data.py`: Unit tests for utility functions (fast, no indexing required)
80+
- `config.yaml`: Minimal test configuration with 1 repository
81+
- `README.md`: This file
82+
6783
## Notes
6884

69-
- The minimal test configuration is set via `HOLOVIZ_MCP_DEFAULT_DIR` environment variable in the test file
70-
- Fast tests verify core functionality without triggering indexing
71-
- Slow tests verify the complete indexing and search pipeline
85+
- The minimal test configuration is set via `HOLOVIZ_MCP_DEFAULT_DIR` environment variable in test files
86+
- Fast tests (2 total) verify core functionality without triggering indexing
87+
- Slow tests (24 total) verify the complete indexing and search pipeline
7288
- First run will clone the panel repository and build the index (2-5 minutes)
7389
- Subsequent runs reuse the cached index (~30 seconds)

tests/docs_mcp/test_docs_mcp_reference_guide.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
Comprehensive tests for the get_reference_guide tool in the documentation MCP server.
33
44
Tests the get_reference_guide tool functionality and all docstring examples.
5+
6+
All tests are marked as slow because they require documentation indexing.
57
"""
68

79
import pytest
@@ -10,6 +12,7 @@
1012
from holoviz_mcp.holoviz_mcp.server import mcp
1113

1214

15+
@pytest.mark.slow
1316
@pytest.mark.asyncio
1417
async def test_get_reference_guide_button_no_project():
1518
"""Test get_reference_guide for Button component across all projects."""
@@ -33,6 +36,7 @@ async def test_get_reference_guide_button_no_project():
3336
assert len(result.data) > 0
3437

3538

39+
@pytest.mark.slow
3640
@pytest.mark.asyncio
3741
async def test_get_reference_guide_button_panel_specific():
3842
"""Test get_reference_guide finds the one and only Button reference guide in Panel project specifically."""
@@ -51,6 +55,7 @@ async def test_get_reference_guide_button_panel_specific():
5155
assert document["relevance_score"] == 1.0
5256

5357

58+
@pytest.mark.slow
5459
@pytest.mark.asyncio
5560
async def test_get_reference_guide_button_panel_material_ui_specific():
5661
"""Test get_reference_guide finds the one and only Button reference guide in Panel Material UI project specifically."""
@@ -69,6 +74,7 @@ async def test_get_reference_guide_button_panel_material_ui_specific():
6974
assert document["relevance_score"] == 1.0
7075

7176

77+
@pytest.mark.slow
7278
@pytest.mark.asyncio
7379
async def test_get_reference_guide_textinput_material_ui():
7480
"""Test get_reference_guide for TextInput component in Material UI project."""
@@ -86,6 +92,7 @@ async def test_get_reference_guide_textinput_material_ui():
8692
assert document["relevance_score"] == 1.0
8793

8894

95+
@pytest.mark.slow
8996
@pytest.mark.asyncio
9097
async def test_get_reference_guide_bar_hvplot():
9198
"""Test get_reference_guide for bar chart component in hvPlot project."""
@@ -109,6 +116,7 @@ async def test_get_reference_guide_bar_hvplot():
109116
assert document["is_reference"] == True
110117

111118

119+
@pytest.mark.slow
112120
@pytest.mark.asyncio
113121
async def test_get_reference_guide_scatter_hvplot():
114122
"""Test get_reference_guide for scatter plot component in hvPlot project."""
@@ -129,6 +137,7 @@ async def test_get_reference_guide_scatter_hvplot():
129137
assert len(result.data) > 0
130138

131139

140+
@pytest.mark.slow
132141
@pytest.mark.asyncio
133142
async def test_get_reference_guide_audio_no_content():
134143
"""Test get_reference_guide for Audio component with content=False for faster response."""
@@ -152,6 +161,7 @@ async def test_get_reference_guide_audio_no_content():
152161
assert len(result.data) > 0
153162

154163

164+
@pytest.mark.slow
155165
@pytest.mark.asyncio
156166
async def test_get_reference_guide_common_widgets():
157167
"""Test get_reference_guide for common Panel widgets."""
@@ -174,6 +184,7 @@ async def test_get_reference_guide_common_widgets():
174184
assert len(result.data) == 1
175185

176186

187+
@pytest.mark.slow
177188
@pytest.mark.asyncio
178189
async def test_get_reference_guide_edge_cases():
179190
"""Test get_reference_guide with edge cases."""
@@ -196,6 +207,7 @@ async def test_get_reference_guide_edge_cases():
196207
assert len(result.data) == 0
197208

198209

210+
@pytest.mark.slow
199211
@pytest.mark.asyncio
200212
async def test_get_reference_guide_relevance_scoring():
201213
"""Test that get_reference_guide returns results with relevance scores."""
@@ -217,6 +229,7 @@ async def test_get_reference_guide_relevance_scoring():
217229
assert scores == sorted(scores, reverse=True)
218230

219231

232+
@pytest.mark.slow
220233
@pytest.mark.asyncio
221234
async def test_get_reference_guide_return_structure():
222235
"""Test that get_reference_guide returns properly structured Documents."""
@@ -256,6 +269,7 @@ async def test_get_reference_guide_return_structure():
256269
assert document["project"] in known_projects
257270

258271

272+
@pytest.mark.slow
259273
@pytest.mark.asyncio
260274
async def test_get_reference_guide_maximum_results():
261275
"""Test that get_reference_guide returns at most 5 results."""
@@ -274,6 +288,7 @@ async def test_get_reference_guide_maximum_results():
274288
assert len(result.data) <= 5
275289

276290

291+
@pytest.mark.slow
277292
@pytest.mark.asyncio
278293
async def test_get_reference_guide_no_duplicates():
279294
"""Test that get_reference_guide doesn't return duplicate results."""
@@ -296,6 +311,7 @@ async def test_get_reference_guide_no_duplicates():
296311
assert len(source_urls) == len(set(source_urls)), "Found duplicate source URLs in results"
297312

298313

314+
@pytest.mark.slow
299315
@pytest.mark.asyncio
300316
async def test_get_reference_guide_multiple_projects():
301317
"""Test that get_reference_guide can find components across multiple projects."""
@@ -315,6 +331,7 @@ async def test_get_reference_guide_multiple_projects():
315331
assert len(projects_found.intersection(expected_projects)) > 0
316332

317333

334+
@pytest.mark.slow
318335
@pytest.mark.asyncio
319336
async def test_get_reference_guide_exact_filename_matching():
320337
"""Test that get_reference_guide prioritizes exact filename matches."""

0 commit comments

Comments
 (0)