Use the DRS conda environment for repository validation:
/datf/hanxi/software/miniconda3/envs/DRS/bin/python -m pytest -qRun from the repository root:
/datf/hanxi/software/drVizer/repo
Tests live in tests/.
Important coverage areas:
| File | Coverage area |
|---|---|
tests/test_bed_parser_acceleration.py |
BED parser behavior, Python/Cython parity, region filtering, BED3 support. |
tests/test_bam_parallel.py |
BAM coverage aggregation, worker caps, int64 accumulators, fallback behavior. |
tests/test_build_parallel_preparation.py |
Deferred track preparation and ordering. |
tests/test_gtf_parser_acceleration.py |
GTF parser fast path behavior and fallbacks. |
tests/test_projection_acceleration.py |
Transcript-to-genomic projection behavior. |
tests/test_split_by_transcript_api.py |
Public API validation and split transcript data preparation. |
tests/test_split_by_transcript_visualizer.py |
Split transcript rendering behavior. |
Most tests construct small temporary GTF, BED, and BAM-like fixtures at runtime. Prefer minimal fixtures that show one behavior rather than copying large real data into the repository.
Good patterns:
- Use
tmp_pathfor temporary files. - Use monkeypatching for external behavior such as multiprocessing pools or pysam calls.
- Assert public API behavior when changing
DrVizworkflow behavior. - Assert lower-level parser behavior when changing parser semantics.
- Keep Python and Cython path expectations aligned when both paths exist.
For bug fixes and behavior changes:
- Add or update a test that fails for the current behavior.
- Run the targeted test and confirm the failure is the expected one.
- Make the smallest code change that passes the test.
- Run the targeted test again.
- Run the full pytest suite.
Examples:
/datf/hanxi/software/miniconda3/envs/DRS/bin/python -m pytest -q tests/test_bed_parser_acceleration.py
/datf/hanxi/software/miniconda3/envs/DRS/bin/python -m pytest -q tests/test_bam_parallel.py
/datf/hanxi/software/miniconda3/envs/DRS/bin/python -m pytest -q tests/test_split_by_transcript_api.pyThe repository has Cython sources for acceleration:
src/drvizer/_cython_projection.pyxsrc/drvizer/_cython_gtf.pyxsrc/drvizer/_cython_bed.pyx
If a .pyx file changes, rebuild extensions from the repository root before relying on Cython-path tests:
/datf/hanxi/software/miniconda3/envs/DRS/bin/python setup.py build_ext --inplaceTests should either exercise the available compiled fast path or skip fast-path checks when the extension is unavailable.
BAM tests should avoid depending on large external files. For parser-level behavior, use monkeypatched pysam.AlignmentFile, fake reads, and fake pool objects where possible.
When real BAM data is needed for local validation, keep it outside the formal repository and document the path in workflow material rather than adding it to tests/.
Before reporting code changes complete:
- Targeted tests for changed behavior pass.
- Full pytest suite passes.
- Cython source and compiled behavior are in sync when
.pyxfiles changed. - New tests cover both public API behavior and low-level parser semantics when both are affected.
- Workflow-only validation files remain outside the source repository.