Skip to content

Commit

Permalink
Include functional tests in code coverage
Browse files Browse the repository at this point in the history
Use the default coverage report file `.coverage` for unit and functional
tests, running Augur in functional tests through an alias that runs
coverage in append mode. Then, use the coverage xml command to generate
the XML report needed by the codecov tool.
  • Loading branch information
huddlej committed Apr 21, 2022
1 parent 002c44f commit 723d609
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 14 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ jobs:
- run: pip install -e .[dev]
- run: conda info
- run: conda list
- run: pytest -c pytest.python3.ini --cov-report=xml --cov=augur
- run: pytest -c pytest.python3.ini --cov=augur
- run: cram --shell=/bin/bash tests/functional/*.t tests/builds/*.t
- run: bash tests/builds/runner.sh
- if: github.repository == 'nextstrain/augur' && matrix.python-version == '3.10' && matrix.biopython-version == ''
run: coverage xml
uses: codecov/codecov-action@v2
with:
fail_ci_if_error: true
Expand Down
3 changes: 2 additions & 1 deletion tests/builds/zika.t
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ Running from the test data directory allows us to use relative paths that won't
$ TEST_DATA_DIR="$TESTDIR/zika"
$ mkdir -p "$TMP/out"
$ pushd "$TEST_DATA_DIR" > /dev/null
$ export AUGUR="../../../bin/augur"
$ export COVERAGE_FILE="$TESTDIR/../../.coverage"
$ export AUGUR="coverage run -a --rcfile=$TESTDIR/../../.coveragerc ../../../bin/augur"

Parse a FASTA whose defline contains metadata into separate sequence and metadata files.

Expand Down
3 changes: 2 additions & 1 deletion tests/builds/zika_compressed.t
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ Running from the test data directory allows us to use relative paths that won't
$ TEST_DATA_DIR="$TESTDIR/zika"
$ mkdir -p "$TMP/out"
$ pushd "$TEST_DATA_DIR" > /dev/null
$ export AUGUR="../../../bin/augur"
$ export COVERAGE_FILE="$TESTDIR/../../.coverage"
$ export AUGUR="coverage run -a --rcfile=$TESTDIR/../../.coveragerc ../../../bin/augur"

Parse a FASTA whose defline contains metadata into separate sequence and metadata files.

Expand Down
3 changes: 2 additions & 1 deletion tests/functional/ancestral.t
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
Integration tests for augur ancestral.

$ pushd "$TESTDIR" > /dev/null
$ export AUGUR="../../bin/augur"
$ export COVERAGE_FILE="$TESTDIR/../../.coverage"
$ export AUGUR="coverage run -a --rcfile=$TESTDIR/../../.coveragerc ../../bin/augur"

Infer ancestral sequences for the given tree and alignment.
The default is to infer ambiguous bases, so there should not be N bases in the inferred output sequences.
Expand Down
5 changes: 3 additions & 2 deletions tests/functional/clades.t
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
Integration tests for augur clades.

$ pushd "$TESTDIR" > /dev/null
$ export AUGUR="../../bin/augur"
$ export COVERAGE_FILE="$TESTDIR/../../.coverage"
$ export AUGUR="coverage run -a --rcfile=$TESTDIR/../../.coveragerc ../../bin/augur"

Test augur clades with simple Zika input files and hierarchical clades.

Expand All @@ -13,4 +14,4 @@ Test augur clades with simple Zika input files and hierarchical clades.

$ python3 "$TESTDIR/../../scripts/diff_jsons.py" clades/clades.json "$TMP/clades.json" \
> --exclude-paths "root['generated_by']"
{}
{}
3 changes: 2 additions & 1 deletion tests/functional/export_v2.t
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
Integration tests for augur export v2.

$ pushd "$TESTDIR" > /dev/null
$ export AUGUR="../../bin/augur"
$ export COVERAGE_FILE="$TESTDIR/../../.coverage"
$ export AUGUR="coverage run -a --rcfile=$TESTDIR/../../.coveragerc ../../bin/augur"

Minimal export

Expand Down
3 changes: 2 additions & 1 deletion tests/functional/filter.t
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
Integration tests for augur filter.

$ pushd "$TESTDIR" > /dev/null
$ export AUGUR="../../bin/augur"
$ export COVERAGE_FILE="$TESTDIR/../../.coverage"
$ export AUGUR="coverage run -a --rcfile=$TESTDIR/../../.coveragerc ../../bin/augur"

Filter with exclude query for two regions that comprise all but one strain.
This filter should leave a single record from Oceania.
Expand Down
3 changes: 2 additions & 1 deletion tests/functional/frequencies.t
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
Integration tests for augur frequencies.

$ pushd "$TESTDIR" > /dev/null
$ export AUGUR="../../bin/augur"
$ export COVERAGE_FILE="$TESTDIR/../../.coverage"
$ export AUGUR="coverage run -a --rcfile=$TESTDIR/../../.coveragerc ../../bin/augur"

Calculate KDE-based tip frequencies from a refined tree.
Timepoints used to estimate frequencies (i.e., "pivots") get calculated from the range of dates in the given metadata.
Expand Down
3 changes: 2 additions & 1 deletion tests/functional/mask.t
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
Integration tests for augur mask.

$ pushd "$TESTDIR" > /dev/null
$ export AUGUR="../../bin/augur"
$ export COVERAGE_FILE="$TESTDIR/../../.coverage"
$ export AUGUR="coverage run -a --rcfile=$TESTDIR/../../.coveragerc ../../bin/augur"

Try masking a VCF without any specified mask.

Expand Down
3 changes: 2 additions & 1 deletion tests/functional/parse.t
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
Integration tests for augur parse.

$ pushd "$TESTDIR" > /dev/null
$ export AUGUR="../../bin/augur"
$ export COVERAGE_FILE="$TESTDIR/../../.coverage"
$ export AUGUR="coverage run -a --rcfile=$TESTDIR/../../.coveragerc ../../bin/augur"

Parse Zika sequences into sequences and metadata.

Expand Down
3 changes: 2 additions & 1 deletion tests/functional/refine.t
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
Integration tests for augur refine.

$ pushd "$TESTDIR" > /dev/null
$ export AUGUR="../../bin/augur"
$ export COVERAGE_FILE="$TESTDIR/../../.coverage"
$ export AUGUR="coverage run -a --rcfile=$TESTDIR/../../.coveragerc ../../bin/augur"

Try building a time tree.

Expand Down
3 changes: 2 additions & 1 deletion tests/functional/traits.t
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
Integration tests for augur traits.

$ pushd "$TESTDIR" > /dev/null
$ export AUGUR="../../bin/augur"
$ export COVERAGE_FILE="$TESTDIR/../../.coverage"
$ export AUGUR="coverage run -a --rcfile=$TESTDIR/../../.coveragerc ../../bin/augur"

Infer the ancestral region for a given tree and metadata.

Expand Down
3 changes: 2 additions & 1 deletion tests/functional/tree.t
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
Integration tests for augur tree.

$ pushd "$TESTDIR" > /dev/null
$ export AUGUR="../../bin/augur"
$ export COVERAGE_FILE="$TESTDIR/../../.coverage"
$ export AUGUR="coverage run -a --rcfile=$TESTDIR/../../.coveragerc ../../bin/augur"

Try building a tree with IQ-TREE.

Expand Down

0 comments on commit 723d609

Please sign in to comment.