Testing Guide

This guide covers running tests, adding new tests, and accuracy validation for py-gbcms.

Running Tests

Quick Test

# Run all tests
pytest -v

# Run with coverage
pytest --cov=gbcms --cov-report=html

# Run specific test file
pytest tests/test_accuracy.py -v

Test Categories

Category
Files
Purpose

Accuracy

test_accuracy.py

SNP, indel, complex variant counting

CLI

test_cli_sample_id.py

Command-line parsing

Filters

test_filters.py

Read filtering logic

MAF

test_maf_*.py

MAF column preservation

Pipeline

test_pipeline_v2.py

End-to-end workflow

Strand

test_strand_counts.py

Strand-specific counts


Test Structure


Writing Tests

Basic Test Template

Accuracy Test Template


Manual Validation

Using samtools for Spot-Check

Comparing with gbcms Output


Accuracy Validation

Variant Types Tested

Type
Test
Status

SNP

test_snp_accuracy

Insertion

test_insertion_accuracy

Deletion

test_deletion_accuracy

Complex

test_complex_accuracy

MNP

test_mnp_accuracy

Real-World Validation


Coverage Targets

Module
Target
Current

cli.py

80%

79%

pipeline.py

70%

29%

io/input.py

85%

82%

io/output.py

90%

96%

models/core.py

90%

90%

Run coverage report:

Last updated