Imported from docdyhr/simplenote-mcp-server (
tests/AGENTS.md). Install upstream withnpx skills add docdyhr/simplenote-mcp-server --skill tests. Copyright stays with the author.
tests/
Purpose
Primary, CI-wired pytest tree (testpaths = tests in pytest.ini) — 64 test files. All new tests go here, not in the legacy simplenote_mcp/tests/ tree (see that folder's AGENTS.md).
Ownership
- One
test_*.pyper source module/feature area (e.g.test_cache.py,test_advanced_search.py,test_tool_handlers*.py,test_auth*.py,test_config.py). conftest.py— shared fixtures, all autouse unless noted:isolate_token_file_cache(redirects the keychain token-cache path totmp_path),reset_write_budget,reset_config_cache, plus non-autousemock_simplenote_client,simplenote_env_vars,server_context,authenticated_context.fixtures_rate_limit.py,fixtures_retry.py— shared fixture modules for rate-limit/retry test scenarios.unit/— currently empty;test_server_comprehensive.py.disabled/test_server_integration.py.disabledat this level are intentionally disabled, not stale cruft to delete without checking why first.
Local Contracts
- Run with
SIMPLENOTE_OFFLINE_MODE=true— real Simplenote credentials must never be required to run this suite. pytest.iniis the active pytest config. pytest ignores[tool.pytest.ini_options]inpyproject.tomland warns about it at startup (configfile: pytest.ini (WARNING: ignoring pytest config in pyproject.toml…)). Change markers,addoptsand timeouts inpytest.ini.- Coverage gate:
--cov-fail-under=75(pytest.iniaddopts). - Markers available:
unit,integration,perf,performance,security,slow,flaky,timeout,asyncio(--strict-markersenforced — unregistered markers fail collection).network,authandofflineappear only in pyproject's ignored section, so using them fails collection. - Do not merge this tree's pytest invocation with
simplenote_mcp/tests/— both mutate process-global singletons (seesimplenote_mcp/server/monitoring/AGENTS.md) and only reset state for their own tests. - Offline-mode mock client (
server.py::get_simplenote_client()) returns({}, 0)fromadd_note/get_note/update_note— don't write assertions expecting a populatednote['key']against the raw mock. test_tool_pin_parity.pyfails when pyproject's exactruff/mypypin differs fromrequirements-lock.txt, the pre-commit hookrev:, or a<tool>==pin in a workflow. Dependabot bumps only pyproject and the lock, so on a failing bot PR bump the hookrev:on that branch. Don't loosen the test.
Work Guidance
- New tool handler → add tests here, not in
simplenote_mcp/tests/, persimplenote_mcp/server/AGENTS.md's tool-handler pattern. - Prefer existing fixtures (
mock_simplenote_client,authenticated_context) over hand-rolled mocks; grep for the symbol's real import path before mocking — mock where it's used, not where it's defined.
Verification
make test-fast—SIMPLENOTE_OFFLINE_MODE=true .venv/bin/pytest tests/ -x -q --timeout=30
Child DOX Index
None.
