Instruction file imported from dertnius/sdd-semantic-pipeline (
.github/instructions/tests.instructions.md). Copyright stays with the author.
Test conventions
These rules apply to tests/**.
- Default to the fast lane. A test with no marker must run with neither pandoc
nor an ML model and stay fast. Run
pytest -m "not slow"while iterating. - Markers:
slow— needs the pandoc binary or a real embedding model. Mark any such test.integration— full end-to-end with all services.
- Reuse
tests/conftest.pyfixtures rather than rebuilding state. Notably:hashing_embedder— deterministic, model-free embedder. Inject it intoSemanticPipeline(..., embedding_model=hashing_embedder)to exercise the real index→search path without a model (seetests/test_search_offline.py).sample_document_model— a pre-builtDocumentModelto chunk/embed.- the autouse
PIPELINE_ENFORCE_WORKSPACE=falsefixture bypasses the workspace guard; the contract itself is covered bytest_workspace.py/test_cli_workspace.py.
- Prefer mocks for the vector store and embedder in unit tests; avoid network and large-model downloads in default paths.
pythonpath=["src"]is set inpyproject.toml, soimport sdd_pipelineworks without installing.- Test the contract, not internal incidentals — the offline search tests assert
filters narrow / output is stable / hybrid runs, not semantic relevance (that lives
in the
slowe2e tests). - A skill/asset wiring test should skip when the asset is absent (e.g.
.claude/is gitignored) — seetest_docs_sync_skill.py.