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 14 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
11 changes: 0 additions & 11 deletions .coveragerc

This file was deleted.

12 changes: 4 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
*.pyc
_trial_temp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's hard to tell which parts of this diff are spurious and which are actual change. can you keep the old order?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, it's not that big a file, and I don't think it helped that much, but re-ordered.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reordered in 3e7d556

build
htmlcov
.coverage
*.egg-info
.tox/
docs/_build/
__pycache__
/docs/_build/
.DS_Store
dist/
/src/*.egg-info
/.tox/
*~
47 changes: 20 additions & 27 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,37 +27,37 @@ branches:
matrix:
include:
# PyPy (Python 2.7)
- env: TOXENV=trial-pypy-tw155 PYPY_VERSION=5.7.1
- env: TOXENV=trial-pypy-tw160 PYPY_VERSION=5.7.1
- env: TOXENV=trial-pypy-twcurrent PYPY_VERSION=5.7.1
- env: TOXENV=trial-pypy-twtrunk PYPY_VERSION=5.7.1
- env: TOXENV=coverage-pypy-tw155,codecov PYPY_VERSION=5.7.1
- env: TOXENV=coverage-pypy-tw160,codecov PYPY_VERSION=5.7.1
- env: TOXENV=coverage-pypy-twcurrent,codecov PYPY_VERSION=5.7.1
- env: TOXENV=coverage-pypy-twtrunk,codecov PYPY_VERSION=5.7.1

- python: 2.7
env: TOXENV=trial-py27-tw155
env: TOXENV=coverage-py27-tw155
- python: 2.7
env: TOXENV=trial-py27-tw160
env: TOXENV=coverage-py27-tw160,codecov
- python: 2.7
env: TOXENV=trial-py27-twcurrent
env: TOXENV=coverage-py27-twcurrent,codecov
- python: 2.7
env: TOXENV=trial-py27-twtrunk
env: TOXENV=coverage-py27-twtrunk,codecov

- python: 3.4
env: TOXENV=trial-py34-tw155
env: TOXENV=coverage-py34-tw155,codecov
- python: 3.4
env: TOXENV=trial-py34-tw160
env: TOXENV=coverage-py34-tw160,codecov
- python: 3.4
env: TOXENV=trial-py34-twcurrent
env: TOXENV=coverage-py34-twcurrent,codecov
- python: 3.4
env: TOXENV=trial-py34-twtrunk
env: TOXENV=coverage-py34-twtrunk,codecov

- python: 3.5
env: TOXENV=trial-py35-tw155
env: TOXENV=coverage-py35-tw155,codecov
- python: 3.5
env: TOXENV=trial-py35-tw160
env: TOXENV=coverage-py35-tw160,codecov
- python: 3.5
env: TOXENV=trial-py35-twcurrent
env: TOXENV=coverage-py35-twcurrent,codecov
- python: 3.5
env: TOXENV=trial-py35-twtrunk
env: TOXENV=coverage-py35-twtrunk,codecov

- python: 3.5
env: TOXENV=flake8
Expand All @@ -70,11 +70,10 @@ matrix:

allow_failures:
# Tests against Twisted trunk are allow to fail, as they are not supported.
- env: TOXENV=trial-py27-twtrunk
- env: TOXENV=trial-py33-twtrunk
- env: TOXENV=trial-py34-twtrunk
- env: TOXENV=trial-py35-twtrunk
- env: TOXENV=trial-pypy-twtrunk
- env: TOXENV=coverage-pypy-twtrunk
- env: TOXENV=coverage-py27-twtrunk
- env: TOXENV=coverage-py34-twtrunk
- env: TOXENV=coverage-py35-twtrunk

# This is not yet required.
- env: TOXENV=twistedchecker-diff
Expand All @@ -89,9 +88,3 @@ install:

script:
- ./.travis/run tox


after_success:
- pip install coverage codecov
- coverage combine
- codecov
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
103 changes: 94 additions & 9 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
[tox]

envlist =
flake8, twistedchecker-diff
flake8

# Twisted 15.5 is the first version to support Python 3 (3.3+)
trial-py{27,py,34,35,36}-tw{155,166,current,trunk}
coverage-py{27,py,34,35,36}-tw{155,166,current,trunk}

docs, docs-linkcheck

skip_missing_interpreters = True


##
# Default testenv
# Default environment: unit tests
##

[testenv]
Expand All @@ -24,10 +24,8 @@ basepython =
py35: python3.5
py36: python3.6

deps =
coverage
mock

deps =
tw150: Twisted==15.0
tw151: Twisted==15.1
tw152: Twisted==15.2
Expand All @@ -45,13 +43,45 @@ deps =
twcurrent: Twisted
twtrunk: https://github.com/twisted/twisted/archive/trunk.zip

{trial,coverage}: mock

coverage: coverage


passenv =
PATH
CI CONTINUOUS_INTEGRATION
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see anything in this changeset which references these. Are they for Hypothesis in #181?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah

TRAVIS TRAVIS_* _system_*
CODECOV_OPTIONS


setenv =
PIP_DISABLE_PIP_VERSION_CHECK=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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be .html rather than _html?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's a directory name

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


commands =
"{toxinidir}/.travis/environment"
coverage run -p "{envdir}/bin/trial" {posargs:klein}

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

coverage: python -c 'import os; d="{toxworkdir}/coverage"; os.makedirs(d) if not os.path.exists(d) else None'
coverage: coverage run --rcfile="{toxinidir}/coverage.conf" "{envdir}/bin/trial" --random=0 --logfile="{envlogdir}/trial.log" --temp-directory="{envlogdir}/trial.d" {posargs:klein}

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/*"



##
# Run flake8
# Flake8 linting
##

[testenv:flake8]
Expand All @@ -71,6 +101,7 @@ basepython = python3.5

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

flake8 {posargs:src/klein}


Expand Down Expand Up @@ -102,6 +133,7 @@ application-import-names = klein
max-complexity = 21



##
# Run twistedchecker
##
Expand All @@ -114,9 +146,11 @@ basepython = python2.7

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

twistedchecker {posargs:klein}



##
# Run twistedchecker on changes relative to master
##
Expand All @@ -131,7 +165,58 @@ basepython = python2.7

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

"{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
##

[testenv:codecov]

basepython = python3.5

skip_install = True

deps = codecov


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

coverage combine --append

# Generate XML and publish to codecov.io
coverage xml --rcfile="{toxinidir}/coverage.conf" -o "{env:COVERAGE_XML}"
codecov --required --file="{env:COVERAGE_XML}" {env:CODECOV_OPTIONS:}



##
Expand Down