Skip to content

Commit

Permalink
add 'coverage' environment for tox
Browse files Browse the repository at this point in the history
  • Loading branch information
warner committed May 24, 2016
1 parent 88696dd commit 783cd98
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .coveragerc
@@ -1,3 +1,5 @@
# -*- mode: conf -*-

[run]
# only record trace data for wormhole.*
source =
Expand Down
16 changes: 16 additions & 0 deletions src/wormhole/test/run_trial.py
@@ -0,0 +1,16 @@

# This is a tiny helper module, to let "python -m wormhole.test.run_trial
# ARGS" does the same thing as running "trial ARGS" (unfortunately
# twisted/scripts/trial.py does not have a '__name__=="__main__"' clause).
#
# This makes it easier to run trial under coverage from tox:
# * "coverage run trial ARGS" is how you'd usually do it
# * but "trial" must be the one in tox's virtualenv
# * "coverage run `which trial` ARGS" works from a shell
# * but tox doesn't use a shell
# So use:
# "coverage run -m wormhole.test.run_trial ARGS"

from twisted.scripts.trial import run

run()
11 changes: 11 additions & 0 deletions tox.ini
Expand Up @@ -32,3 +32,14 @@ commands =
# a script name (since "python -m twisted.scripts.trial" doesn't have a 'if
# __name__ == "__main__": run()' -style clause). The script name will vary on
# the platform.

[testenv:coverage]
deps =
pyflakes >= 1.2.3
mock
coverage
{env:EXTRA_DEPENDENCY:}
commands =
pyflakes setup.py src
wormhole --version
coverage run --branch -m wormhole.test.run_trial {posargs:wormhole}

0 comments on commit 783cd98

Please sign in to comment.