Instant DevelopersDeveloperTesting

Testing

|||

INDW test profiles, pytest markers, and writing subsystem tests for pipeline changes.

INDW uses pytest with marker-based profiles for unit, integration, parity, and certification testing. Run tests via the CLI or directly with pytest.

Test profiles

bash
indw test --profile unit        # fast, default
indw test --profile critical    # production-critical subsystems
indw test --profile parity      # backend parity (same as indw validate)
indw test --profile integration # integration + slow
indw test --profile smoke       # end-to-end smoke
ProfileMarkersParallelPaths
unitnot integration and not slowYes (-n auto)tests/
criticalcritical and not integrationNotests/subsystems/
parityintegrationNoparity test files
integrationintegration or slowNotests/
smokesmokeNotests/

Parity tests

Parity tests verify determinism across backends and worker counts:

bash
indw validate

Key parity test files:

FileVerifies
test_stage_pool_parity.pyStage pool output consistency
test_parallel_merge_parity.pyWorkers=1 vs workers=N hash match
test_tier_admission_parity.pyAdmission tier consistency
test_execution_backend.pyLocal vs multiprocess backend match

Pytest markers

python
import pytest
 
@pytest.mark.critical
def test_quality_gate_rejects_short_docs():
    ...
 
@pytest.mark.integration
def test_merge_multiprocess_parity():
    ...
 
@pytest.mark.property
def test_content_hash_deterministic():
    ...
 
@pytest.mark.benchmark
def test_stage0_throughput():
    ...

Available markers: integration, slow, smoke, critical, property, benchmark, certification.

Running pytest directly

bash
cd instant-ai/model_registry/data
python -m pytest tests/subsystems/ -m "critical" -v
python -m pytest tests/subsystems/test_parallel_merge_parity.py -v

Extra pytest arguments pass through the CLI:

bash
indw test --profile unit -k test_stage0
indw test --profile critical -- --cov=indw --cov-report=term-missing

Writing subsystem tests

Place integration tests in tests/subsystems/. Follow existing patterns:

python
import pytest
from pathlib import Path
from indw.filter.spec.quality import QualityPipelineConfig
from indw.schedule import merge_with_quality
 
@pytest.mark.critical
def test_merge_produces_output(tmp_path):
    raw = tmp_path / "raw" / "test"
    raw.mkdir(parents=True)
    (raw / "data.jsonl").write_text('{"text": "A valid document with enough content to pass gates."}\n')
 
    out = tmp_path / "out.jsonl"
    work = tmp_path / "work"
 
    result = merge_with_quality(raw.parent, out, work_dir=work, fresh=True, workers=1)
    assert result["kept"] >= 1
    assert out.exists()

Test fixtures

Red team and regression fixtures live in tests/fixtures/:

text
tests/fixtures/
└── redteam/
    ├── redteam_archive.jsonl
    └── redteam_event.jsonl

Use fixtures for adversarial content testing (PII, toxicity, prompt injection).

Coverage

bash
pip install -e ".[dev]"
python -m pytest tests/ --cov=indw --cov=app --cov-report=term-missing

Coverage threshold is 55% (fail_under in pyproject.toml).

CI recommendation

bash
indw doctor
indw test --profile unit
indw test --profile critical
indw validate
Test before merge:

Pipeline changes that affect acceptance decisions require indw validate to pass. Hash parity is a merge blocker for production pipelines.

© 2026 Instant Developers. All rights reserved.