mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-18 02:40:07 +00:00
tox: add "coverage" environment
Run with "tox -e coverage". Uses a new helper module (allmydata.test.run_trial) to let us import+execute trial without knowing exactly where the "trial" binary lives, which helps with using "coverage run" under tox.
This commit is contained in:
parent
1e1e86fe35
commit
608719df91
10
.coveragerc
Normal file
10
.coveragerc
Normal file
@ -0,0 +1,10 @@
|
||||
# -*- mode: conf -*-
|
||||
|
||||
[run]
|
||||
# only record trace data for allmydata.*
|
||||
source =
|
||||
allmydata
|
||||
# and don't trace the test files themselves, or generated files
|
||||
omit =
|
||||
*/allmydata/test/*
|
||||
*/allmydata/_version.py
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -37,3 +37,4 @@ zope.interface-*.egg
|
||||
/violations.txt
|
||||
/.tox/
|
||||
/docs/_build/
|
||||
/coverage.xml
|
||||
|
16
src/allmydata/test/run_trial.py
Normal file
16
src/allmydata/test/run_trial.py
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
# This is a tiny helper module, to let "python -m allmydata.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 allmydata.test.run_trial ARGS"
|
||||
|
||||
from twisted.scripts.trial import run
|
||||
|
||||
run()
|
9
tox.ini
9
tox.ini
@ -15,6 +15,15 @@ commands =
|
||||
tahoe --version
|
||||
trial --rterrors {posargs:allmydata}
|
||||
|
||||
[testenv:coverage]
|
||||
# coverage (with --branch) takes about 65% longer to run
|
||||
passenv = USERPROFILE HOMEDRIVE HOMEPATH
|
||||
skip_install = True
|
||||
deps = --editable=.[test]
|
||||
commands =
|
||||
tahoe --version
|
||||
coverage run --branch -m allmydata.test.run_trial --rterrors --reporter=timing {posargs:allmydata}
|
||||
|
||||
[testenv:deprecations]
|
||||
basepython=python2.7
|
||||
passenv = USERPROFILE HOMEDRIVE HOMEPATH
|
||||
|
Loading…
Reference in New Issue
Block a user