magic-wormhole/src/wormhole/test/run_trial.py
Brian Warner 71f34e4f5b test/run_trial.py: protect run() with __name__
Without this, any import (e.g. when running "automat-visualize") caused the
tests to be run as a side-effect.
2017-02-22 18:03:33 -08:00

17 lines
657 B
Python

from __future__ import unicode_literals
# 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"
if __name__ == "__main__":
from twisted.scripts.trial import run
run()