Skip to content

Commit 60e55ff

Browse files
authored
Merge pull request #101 from CardiacModelling/coverage
Add scripts to coverage testing
2 parents 36d3eac + e7125e8 commit 60e55ff

8 files changed

Lines changed: 420 additions & 327 deletions

File tree

.github/workflows/pytest.yml

Lines changed: 0 additions & 58 deletions
This file was deleted.

.github/workflows/tests.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Tests
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
types: [opened, synchronize, reopened, ready_for_review]
8+
branches:
9+
- '**'
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
if: github.event.pull_request.draft == false
15+
16+
env:
17+
python-latest: 3.14
18+
strategy:
19+
matrix:
20+
python-version: ['3.10', 3.11, 3.12, 3.13, 3.14]
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
26+
- name: Set up Python ${{ matrix.python-version }}
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version: ${{ matrix.python-version }}
30+
31+
- name: Install dependencies
32+
run: |
33+
python -m pip install --upgrade pip
34+
python -m pip install -e .[test]
35+
36+
- name: Check code style with flake8
37+
if: ${{ matrix.python-version == env.python-latest }}
38+
run: |
39+
python -m flake8 pcpostprocess/*.py tests/*.py pcpostprocess/scripts/*.py
40+
41+
- name: Check import ordering with isort
42+
if: ${{ matrix.python-version == env.python-latest }}
43+
run: |
44+
python -m isort --verbose --check-only --diff pcpostprocess tests setup.py
45+
46+
- name: Extract test data
47+
run: |
48+
wget https://cardiac.nottingham.ac.uk/syncropatch_export/test_data.tar.xz -P tests/
49+
tar xvf tests/test_data.tar.xz -C tests/
50+
51+
- name: Run unit tests (without coverage testing)
52+
if: ${{ success() && matrix.python-version != env.python-latest }}
53+
run: python -m unittest
54+
55+
- name: Run unit tests (with coverage testing)
56+
if: ${{ success() && matrix.python-version == env.python-latest }}
57+
run: coverage run -m unittest
58+
59+
- name: Install TeX dependencies for run_herg_qc test
60+
timeout-minutes: 15
61+
run: sudo apt-get install dvipng texlive-latex-extra texlive-fonts-recommended cm-super -y
62+
63+
- name: Run `run_herg_qc` script
64+
timeout-minutes: 15
65+
run: pcpostprocess run_herg_qc tests/test_data/13112023_MW2_FF -w A01 A02 A03
66+
67+
- name: Report coverage to codecov
68+
uses: codecov/codecov-action@v4
69+
if: ${{ success() && matrix.python-version == env.python-latest }}
70+
with:
71+
token: ${{ secrets.CODECOV_TOKEN }}
72+

CONTRIBUTING.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ In addition to the rules checked by flake8, we try to use single quotes (`'`) fo
6060

6161
### Spelling
6262

63-
**TODO WE SHOULD MAYBE DISCUSS WHICH ENGLISH TO USE? [#106](https://github.com/CardiacModelling/pcpostprocess/issues/106)**
63+
Class, method, and argument names are in UK english.
6464

6565
### Import ordering
6666

@@ -95,6 +95,8 @@ make html
9595
[reStructuredText](http://docutils.sourceforge.net/docs/user/rst/quickref.html)
9696
[Sphinx](http://www.sphinx-doc.org/en/stable/)
9797

98+
UK english
99+
98100
## Testing
99101

100102
To run all unit tests, locally:

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Unit tests](https://github.com/CardiacModelling/pcpostprocess/actions/workflows/pytest.yml/badge.svg)](https://github.com//CardiacModelling/pcpostprocess/actions/workflows/pytest.yml)
1+
[![Unit tests](https://github.com/CardiacModelling/pcpostprocess/actions/workflows/tests.yml/badge.svg)](https://github.com//CardiacModelling/pcpostprocess/actions/workflows/tests.yml)
22
[![codecov](https://codecov.io/gh/CardiacModelling/pcpostprocess/graph/badge.svg?token=HOL0FrpGqs)](https://codecov.io/gh/CardiacModelling/pcpostprocess)
33

44
This repository contains a python package and scripts for handling time-series data from patch-clamp experiments.
@@ -19,13 +19,15 @@ cd pcpostprocess
1919
Create and activate a virtual environment.
2020

2121
```sh
22-
python3 -m venv .venv && source .venv/bin/activate
22+
python3 -m venv .venv
23+
source .venv/bin/activate
2324
```
2425

2526
Then install the package with `pip`.
2627

2728
```sh
28-
python3 -m pip install --upgrade pip && python3 -m pip install -e .'[test]'
29+
python3 -m pip install --upgrade pip
30+
python3 -m pip install -e .'[test]'
2931
```
3032

3133
To run the tests you must first download some test data.

example_export_config.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44

55
# Copy this config file to the top-level data directory and modify fields.
66

7-
# Data output directory
8-
savedir = './data'
9-
107
# Save name for this set of data
118
saveID = 'EXPERIMENT_NAME'
129

pcpostprocess/scripts/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def main():
1818
sys.argv.pop(1) # Subcommand's argparser shouldn't see this
1919

2020
if args.subcommand == "run_herg_qc":
21-
run_herg_qc.main()
21+
run_herg_qc.run_from_command_line()
2222

2323
elif args.subcommand == "summarise_herg_export":
2424
summarise_herg_export.main()

0 commit comments

Comments
 (0)