Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up coverage generation and reporting in tox & travis. #187

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f78bca5
Clean up:
wsanchez Jun 21, 2017
65a7344
[paths] section isn't needed.
wsanchez Jun 21, 2017
fd0e2f9
Clean up tox config:
wsanchez Jun 21, 2017
77390bb
Better comment
wsanchez Jun 28, 2017
7aac72d
No more whitelist_externals
wsanchez Jun 28, 2017
f02c021
No LANG
wsanchez Jun 28, 2017
862acc5
Simpler mkdir replacement
wsanchez Jun 28, 2017
d44dc11
Rename .coveragerc to coverage.conf
wsanchez Jun 28, 2017
657da86
No coverage_combine in default envlist
wsanchez Jun 28, 2017
3e7d556
Reorder for moshez
wsanchez Jun 28, 2017
444b976
Merge branch 'master' into coverage
wsanchez Jun 28, 2017
6bcccb1
Require -html and/or -xml qualifier to run html and/or xml coverage r…
wsanchez Jun 28, 2017
a51e628
Merge branch 'coverage' of github.com:twisted/klein into coverage
wsanchez Jun 28, 2017
bc03700
Move fail_under from config to --fail-under in command line when it m…
wsanchez Jun 29, 2017
39a742f
Merge branch 'master' into coverage
wsanchez Jul 3, 2017
a7a1659
cosmetic
wsanchez Jul 3, 2017
1583db9
Merge branch 'master' into coverage
wsanchez Jul 4, 2017
586d77a
Merge branch 'master' into coverage
wsanchez Jul 4, 2017
7ce96c9
Comment
wsanchez Jul 4, 2017
c583d61
Pull up from ignore-paths
wsanchez Jul 4, 2017
8a2ebc2
Remove extra env vars
wsanchez Jul 10, 2017
3543943
cosmetic
wsanchez Jul 10, 2017
b828beb
Merge branch 'master' into coverage
wsanchez Jul 14, 2017
54ef3a2
Merge branch 'master' into coverage
wsanchez Sep 13, 2017
a73859b
Merge branch 'master' into coverage
glyph Oct 22, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .coveragerc

This file was deleted.

2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
*.pyc
/_trial_temp/
/build/
htmlcov
.coverage
/src/*.egg-info
/.tox/
/docs/_build/
Expand Down
7 changes: 7 additions & 0 deletions coverage.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[run]
branch = True
source = klein

[report]
precision = 2
show_missing = True
59 changes: 48 additions & 11 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,28 @@ setenv =
PIP_DISABLE_PIP_VERSION_CHECK=1
VIRTUALENV_NO_DOWNLOAD=1

coverage: COVERAGE_FILE={toxworkdir}/coverage/coverage.{envname}
{coverage_combine,codecov}: COVERAGE_FILE={toxworkdir}/coverage/coverage

{coverage,coverage_combine}: COVERAGE_HTML={envlogdir}/coverage_report_html
{coverage,coverage_combine,codecov}: COVERAGE_XML={envlogdir}/coverage_report.xml

commands =
"{toxinidir}/.travis/environment"

# Run trial without coverage
trial: trial --random=0 --logfile="{envlogdir}/trial.log" --temp-directory="{envlogdir}/trial.d" {posargs:klein}

# Create a directory for coverage reports
coverage: python -c 'import os; d="{toxworkdir}/coverage"; os.makedirs(d) if not os.path.exists(d) else None'

# Run trial with coverage
coverage: coverage run -p "{envbindir}/trial" --random=0 --logfile="{envlogdir}/trial.log" --temp-directory="{envlogdir}/trial.d" {posargs:klein}
coverage: coverage run --rcfile="{toxinidir}/coverage.conf" "{envdir}/bin/trial" --random=0 --logfile="{envlogdir}/trial.log" --temp-directory="{envlogdir}/trial.d" {posargs:klein}

# Coverage reports
coverage-html: coverage html --rcfile="{toxinidir}/coverage.conf" -d "{env:COVERAGE_HTML}"
coverage-xml: coverage xml --rcfile="{toxinidir}/coverage.conf" -o "{env:COVERAGE_XML}"
coverage: coverage report --rcfile="{toxinidir}/coverage.conf" --skip-covered --omit "*/test/*"


##
Expand All @@ -72,6 +86,8 @@ commands =

[testenv:flake8]

basepython = python3.5

skip_install = True

deps =
Expand All @@ -83,8 +99,6 @@ deps =
pep8-naming
mccabe

basepython = python3.5

commands =
"{toxinidir}/.travis/environment"

Expand Down Expand Up @@ -125,10 +139,10 @@ max-complexity = 21

[testenv:twistedchecker]

deps = twistedchecker

basepython = python2.7

deps = twistedchecker

commands =
"{toxinidir}/.travis/environment"

Expand All @@ -141,18 +155,41 @@ commands =

[testenv:twistedchecker-diff]

basepython = python2.7

deps =
{[testenv:twistedchecker]deps}
diff_cover

basepython = python2.7

commands =
"{toxinidir}/.travis/environment"

"{toxinidir}/.travis/twistedchecker-diff" {posargs:klein}


##
# Combine coverage reports
##

[testenv:coverage_combine]

basepython = python3.5

skip_install = True

deps = coverage

commands =
"{toxinidir}/.travis/environment"

coverage combine --append

coverage html --rcfile="{toxinidir}/coverage.conf" -d "{env:COVERAGE_HTML}"
coverage xml --rcfile="{toxinidir}/coverage.conf" -o "{env:COVERAGE_XML}"

coverage report --rcfile="{toxinidir}/coverage.conf" --fail-under=100 --omit "*/test/*"


##
# Publish to Codecov
##
Expand All @@ -179,12 +216,12 @@ commands =

[testenv:docs]

basepython = python2.7

deps =
sphinx
sphinx_rtd_theme

basepython = python2.7

commands =
"{toxinidir}/.travis/environment"

Expand All @@ -197,10 +234,10 @@ commands =

[testenv:docs-linkcheck]

deps = {[testenv:docs]deps}

basepython = python2.7

deps = {[testenv:docs]deps}

commands =
"{toxinidir}/.travis/environment"

Expand Down