Testing
The project includes comprehensive tests for both the library and the MCP server.
Testing the MCP Server
The MCP server ships with a dedicated integration test suite in
integration_testing/test_mcp_server.py. All tests call the MCP tool
functions directly (not via the protocol transport) so they exercise exactly
the same code paths an AI assistant uses — without requiring a running server
process.
The suite is excluded from the default pytest run (--ignore=integration_testing
in pyproject.toml) because some tests make live S3 requests or execute full
Jupyter notebooks, which would be too slow and network-dependent for a standard
CI run.
Prerequisites
Install the mcp optional dependency group before running:
pip install -e ".[mcp]"
# or with poetry:
poetry install --extras mcp
Test Tiers and CLI Flags
Three custom flags control which test tiers are enabled.
Flag |
Mark applied |
What it enables |
|---|---|---|
(none) |
— |
Offline tests only (catalog, plot guide, Python REPL). No network access required. Runs in ~8 s. |
|
|
Adds live anonymous S3 queries: |
|
|
Adds notebook tests (S3 also required): Synthetic unit tests ( Scripted-agent generation ( Real user scenarios ( |
|
both |
Short-hand for |
Marked tests are automatically skipped unless the corresponding flag is
passed — there is no need to use -m expressions.
Running the Tests
# Fast offline tests (catalog, plot-guide, Python REPL) — no network needed:
pytest integration_testing/test_mcp_server.py -v
# Include live S3 queries:
pytest integration_testing/test_mcp_server.py -v --run-s3
# Scripted-agent notebook generation (also needs --run-s3):
pytest integration_testing/test_mcp_server.py -v --run-s3 --run-notebooks
# Run everything:
pytest integration_testing/test_mcp_server.py -v --run-all
Test Classes
Class |
Tests |
Description |
|---|---|---|
|
13 |
|
|
8 |
|
|
8 |
|
|
7 |
|
|
2 |
|
|
10 |
|
|
8 |
|
|
2 |
Scripted-agent notebook generation. Simulates an AI workflow for
Argo (parquet) and SST (zarr): calls |
|
5 |
Five real user-question scenarios. Each chains the full MCP tool
sequence ( |
End-to-End Scenarios
Each scenario encodes a real user question. The test chains MCP tools in the same order an AI assistant would, builds a new notebook from the tool outputs, and validates it executes cleanly — no pre-existing notebooks required.
Test / User question |
MCP tool chain |
|---|---|
Coffs Harbour Jan 2020 sea state |
“A notebook showing radar data at Coffs Harbour in January 2020,
compare with Argo and gridded SST.”
search → coverage (argo + SST) → schema (discovers |
SA Gulfs HAB — April, chlorophyll |
“Explore AODN datasets in the HAB area (SA Gulfs 134–141.5°E,
34–39.5°S). Compare datasets across April. Add chlorophyll.”
search (radar, chlorophyll, argo) → coverage → schema → REPL →
generates |
Argo Coral Sea 2018 |
“Argo float T/S profiles in the Coral Sea in 2018.”
schema (confirms |
Mooring temperature near Sydney |
“Mooring temperature near Sydney 2018–2022, include T/S diagram.”
search → schema ( |
SST Southern Ocean Dec–Feb |
“SST anomaly in the Southern Ocean during austral summer.”
search → schema → coverage → REPL →
generates |
Adding New Tests
To add a test for a new dataset or scenario:
Import the MCP tool functions at the top of
test_mcp_server.py:from aodn_cloud_optimised.mcp.server import check_dataset_coverage, ...
Subclass
_McpAgentMixin, unittest.TestCaseand decorate with@pytest.mark.s3+@pytest.mark.notebooks.Follow the 5-step pattern: search → coverage → schema → REPL test →
_make_notebook+validate_notebook. Do not call boto3, xarray, or pandas directly — use only MCP tool functions.