Permalink
Browse files

add 'coverage' environment for tox

  • Loading branch information...
warner committed May 24, 2016
1 parent 88696dd commit 783cd984f61cacbeceeec21a6d06a21e5e9eac0a
Showing with 29 additions and 0 deletions.
  1. +2 −0 .coveragerc
  2. +16 −0 src/wormhole/test/run_trial.py
  3. +11 −0 tox.ini
View
@@ -1,3 +1,5 @@
+# -*- mode: conf -*-
+
[run]
# only record trace data for wormhole.*
source =
@@ -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()
View
11 tox.ini
@@ -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.