Skip to content

Commit 85aedc0

Browse files
ChanceSiyuanclaude
andcommitted
Add test coverage reporting and README badges
- Update CI workflow to generate coverage reports with pytest-cov - Upload coverage to Codecov for tracking - Add test status and coverage badges to README - Add `make test-cov` target for local coverage reports - Update .gitignore to exclude coverage files Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 504d0ee commit 85aedc0

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

.github/workflows/test.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,13 @@ jobs:
2727
- name: Install dependencies
2828
run: uv sync --dev
2929

30-
- name: Run tests
31-
run: uv run pytest --verbose
30+
- name: Run tests with coverage
31+
run: uv run pytest --verbose --cov=bpdecoderplus --cov-report=xml --cov-report=term
32+
33+
- name: Upload coverage to Codecov
34+
uses: codecov/codecov-action@v4
35+
with:
36+
file: ./coverage.xml
37+
flags: unittests
38+
name: codecov-umbrella
39+
fail_ci_if_error: false

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ build/
2323
*.egg
2424
.pytest_cache/
2525
.coverage
26+
coverage.xml
2627
htmlcov/
2728
.uv/
2829
uv.lock

Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
.PHONY: help install setup test generate-dataset clean
1+
.PHONY: help install setup test test-cov generate-dataset clean
22

33
help:
44
@echo "Available targets:"
55
@echo " install - Install uv package manager"
66
@echo " setup - Set up development environment with uv"
77
@echo " generate-dataset - Generate noisy circuit dataset"
88
@echo " test - Run tests"
9+
@echo " test-cov - Run tests with coverage report"
910
@echo " clean - Remove generated files and caches"
1011

1112
install:
@@ -23,8 +24,14 @@ generate-dataset:
2324
test:
2425
uv run pytest
2526

27+
test-cov:
28+
uv run pytest --cov=bpdecoderplus --cov-report=html --cov-report=term
29+
2630
clean:
2731
rm -rf .pytest_cache
2832
rm -rf __pycache__
33+
rm -rf htmlcov
34+
rm -rf .coverage
35+
rm -rf coverage.xml
2936
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
3037
find . -type f -name "*.pyc" -delete

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# BPDecoderPlus: Quantum Error Correction with Belief Propagation
22

3+
[![Tests](https://github.com/GiggleLiu/BPDecoderPlus/actions/workflows/test.yml/badge.svg)](https://github.com/GiggleLiu/BPDecoderPlus/actions/workflows/test.yml)
4+
[![codecov](https://codecov.io/gh/GiggleLiu/BPDecoderPlus/branch/main/graph/badge.svg)](https://codecov.io/gh/GiggleLiu/BPDecoderPlus)
5+
36
A winter school project on circuit-level decoding of surface codes using belief propagation and integer programming decoders, with extensions for atom loss in neutral atom quantum computers.
47

58
## Project Goals

0 commit comments

Comments
 (0)