Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of proposed changes
@huddlej As discussed in PR #543, here's the PR to add just the pytest wrapper for the Cram functional tests, including coverage report.
One noteworthy change: When I submitted this in #543, I got different coverage numbers on my local machine vs. Travis. In this PR, that's no longer the case - I'm now seeing 41% overall coverage both locally and on Travis. Not sure why or how that fixed itself - but, seems to be working now.
This PR does the following:
tests/test_cram.py
, to execute all Cram CLI tests located undertests/
..travis.yml
to execute this test independently from existing Augur unit tests, and to generate a coverage report showing code coverage just for the Cram tests.pytest.python3.ini
to exclude the pytest Cram wrapper when executing unit tests..gitignore
to ignore the coverage datafile.coverage_pytest_cram
.Couple of additional notes:
.travis.yml
and.gitignore
changes are worth calling out. pytest-cov writes a coverage-data file to the default location,.coverage
; Travis then uploads this to codecov.io. I don't want the Cram coverage data to overwrite the unit-test coverage data. So, to keep these separate, I've updated.travis.yml
to setCOVERAGE_FILE=.coverage_pytest_cram
when I callpytest
.On my Travis and Codecov accounts, this seems to work as intended. Codecov correctly shows ~19% unit-test coverage, not the ~40% coverage you'd see if Codecov were picking up the Cram-test coverage data. But, the Codecov bash uploader is a little vague about how it detects coverage files. So, you might want to keep an eye on this. I've added a note for this in the 'Testing' section below.
.travis.yml
, I've left in place the call to execute Cram tests in the 'normal' way (cram --shell=/bin/bash tests/functional/*.t tests/builds/*.t
). This is redundant to the pytest-Cram call, of course - I kept the original just as a control, to prove that pytest-Cram and normal-Cram are both running and succeeding. Up to you guys, but my instinct would be to keep both calls side-by-side for a while, then delete the normal-cram call when everybody's comfortable with pytest-Cram.Related issue(s)
Related to #542 #543
Testing
Locally:
COVERAGE_FILE=.coverage_pytest_cram pytest -vv -s tests/test_cram.py --cov-report=term --cov augur
On Travis:
Run a build. Observe that
tests/test_cram.py
executestests/builds/zika.t
andtests/functional/mask.t
, and both tests pass (example). Observe that this writes a coverage report to terminal, currently showing 41% coverage (example).Check codecov.io to verify that it's still showing coverage for just the
augur
unit tests. Should be ~19% or so - if it's ~40%, then Codecov may have unexpectedly pulled pytest-Cram's coverage data into the mix.