Skip to content

Commit b1f9024

Browse files
psafonttetron
authored andcommitted
Coverage reporting (#691)
* feature: add code coverage reporting uses codecov * feature: add coveralls support * feature: generate coverage reports with make Also makes setuptools install cov-pytest, right now coverage is only generated by unit tests * maintenance: remove coveralls support To avoid failure states * maintenance: add back rules for coverage reports * maintenance: ignore make-generated files * fix: appveyor broken pip install Follow recommendation on https://pythonhosted.org/CodeChat/appveyor.yml.html
1 parent 8194b56 commit b1f9024

File tree

6 files changed

+37
-16
lines changed

6 files changed

+37
-16
lines changed

.coveragerc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
11
[run]
22
branch = True
33
source = cwltool
4+
5+
[report]
6+
exclude_lines =
7+
if self.debug:
8+
pragma: no cover
9+
raise NotImplementedError
10+
if __name__ == .__main__.:
11+
ignore_errors = True
12+
omit =
13+
tests/*

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,16 @@ typeshed/2and3/ruamel/yaml
3030

3131
#mypy
3232
.mypy_cache/
33+
34+
# Files generated by Makefile
35+
.cache/
36+
cache/
37+
.coverage
38+
coverage.xml
39+
htmlcov
40+
output
41+
output.txt
42+
pydocstyle_report.txt
43+
response.txt
44+
test.txt
45+
value

Makefile

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -113,23 +113,18 @@ pylint_report.txt: ${PYSOURCES}
113113
diff_pylint_report: pylint_report.txt
114114
diff-quality --violations=pylint pylint_report.txt
115115

116-
.coverage: $(PYSOURCES) all
117-
export COVERAGE_PROCESS_START=${mkfile_dir}.coveragerc; \
118-
cd ${CWL}; ./run_test.sh RUNNER=cwltool
119-
coverage run setup.py test
120-
coverage combine ${CWL} ${CWL}/draft-3/ ./
116+
.coverage: tests
117+
118+
coverage: .coverage
119+
coverage report
121120

122121
coverage.xml: .coverage
123-
python-coverage xml
122+
coverage xml
124123

125124
coverage.html: htmlcov/index.html
126125

127126
htmlcov/index.html: .coverage
128-
python-coverage html
129-
@echo Test coverage of the Python code is now in htmlcov/index.html
130-
131-
coverage-report: .coverage
132-
python-coverage report
127+
coverage html
133128

134129
diff-cover: coverage-gcovr.xml coverage.xml
135130
diff-cover coverage-gcovr.xml coverage.xml
@@ -139,8 +134,8 @@ diff-cover.html: coverage-gcovr.xml coverage.xml
139134
--html-report diff-cover.html
140135

141136
## test : run the ${MODULE} test suite
142-
test: FORCE
143-
./setup.py test
137+
test: $(PYSOURCES)
138+
python setup.py test --addopts "--cov cwltool"
144139

145140
sloccount.sc: ${PYSOURCES} Makefile
146141
sloccount --duplicates --wide --details $^ > sloccount.sc

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ install:
2727
- "python -c \"import struct; print(struct.calcsize('P') * 8)\""
2828

2929
build_script:
30-
- "%CMD_IN_ENV% pip install -U setuptools"
30+
- "%CMD_IN_ENV% python -m pip install -U setuptools"
3131
- "%CMD_IN_ENV% pip install ."
3232

3333

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
tagger = egg_info_cmd.egg_info
1717

1818
needs_pytest = {'pytest', 'test', 'ptr'}.intersection(sys.argv)
19-
pytest_runner = ['pytest-runner'] if needs_pytest else []
19+
pytest_runner = ['pytest-runner', 'pytest-cov'] if needs_pytest else []
2020

2121
setup(name='cwltool',
2222
version='1.0',

tox.ini

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,15 @@ skip_missing_interpreters = True
1717
3.6 = py36
1818

1919
[testenv]
20+
passenv = CI TRAVIS TRAVIS_*
2021
deps =
2122
-rrequirements.txt
23+
py{27,34,35,36}-unit: codecov
2224
py{27,34,35,36}-lint: flake8
2325

2426
commands =
25-
py{27,34,35,36}-unit: python setup.py test
27+
py{27,34,35,36}-unit: python setup.py test --addopts "--cov-report xml --cov cwltool"
28+
py{27,34,35,36}-unit: codecov
2629
py{27,34,35,36}-lint: flake8 schema_salad setup.py
2730

2831
whitelist_externals =

0 commit comments

Comments
 (0)