Testing¶
Alpha
HOMERun is in alpha testing. Test layout and coverage are still evolving.
The test suite is pure Python: it needs no HOMER, STAR, HISAT2, or skewer, no network, and no SLURM. Every filesystem fixture uses a temporary directory, so the tests run anywhere from a fresh checkout. Fixtures that need external-tool output (FASTQ, SAM, HOMER tag directories) build minimal syntactically-valid fakes by hand instead of shelling out to real tools.
Install test dependencies¶
Run¶
Options are preconfigured in pyproject.toml (testpaths = ["tests"], -ra --strict-markers), so a bare pytest from the repo root runs everything.
Run a subset:
Slow tests are marked; select or skip them:
Because --strict-markers is on, any marker not registered in pyproject.toml is an error — register new markers there before using them.
What's covered¶
- CLI parsing and
main()fast paths — argparse construction,--help, exit codes, and the--count-samples/--count-groups/--check-rerun/--stage-rawcontroller paths that a SLURM wrapper depends on, none of which run the pipeline. - Configuration — flag > env > default precedence, the
_pick()helper,SLURM_CPUS_PER_TASKfallback, and path-builder correctness. - Filename identity —
parse_sample_name,assay_of_leaf/seq_type, replicate markers, and identity-based R2 mate-pairing (including the ENCODE mismatched-accession regression). - Package imports — every public module imports cleanly and
__version__is accessible.
Fixtures (tests/conftest.py)¶
project_dir— an empty temporary project root.make_cfg/cfg— a realConfigpointed at a temporary project, any field overridable.make_fastq— writes a minimal valid FASTQ.staged_sample— aConfigplus one already-staged csRNA replicate.paired_totalrna_sample— a staged totalRNA replicate with both mates present.non_interactive_matplotlib— forces matplotlib's headlessAggbackend so plotting tests never open a GUI window.
Writing new tests¶
- Use
tmp_pathand the provided fixtures; never touch absolute paths or the network. - Build fake tool outputs by hand (see
make_fastq) rather than calling real tools. - Register any new marker in
pyproject.toml, or--strict-markerswill fail the run.