Browse files

Merge pull request #556 from yoinc/master

Forward testing.main kwargs to unittest.main
  • Loading branch information...
2 parents ed7030d + 44aebc2 commit 3ae8915e114caab6a9dfeb973485f43c0eca15bf @bdarnell bdarnell committed Jul 3, 2012
Showing with 10 additions and 3 deletions.
  1. +10 −3 tornado/testing.py
View
13 tornado/testing.py
@@ -367,7 +367,7 @@ def run(self, result=None):
handler.stream = old_stream
-def main():
+def main(**kwargs):
"""A simple test runner.
This test runner is essentially equivalent to `unittest.main` from
@@ -392,6 +392,13 @@ def main():
# Runs one test
python -m tornado.test.runtests tornado.test.stack_context_test
+ Args:
+ kwargs: Keyword arguments passed through to unittest.main().
+ For example:
+ tornado.testing.main(verbosity=2)
+ to show many test details as they are run.
+ See http://docs.python.org/library/unittest.html#unittest.main
+ for full argument list.
"""
from tornado.options import define, options, parse_command_line
@@ -423,9 +430,9 @@ def main():
# test discovery, which is incompatible with auto2to3), so don't
# set module if we're not asking for a specific test.
if len(argv) > 1:
- unittest.main(module=None, argv=argv)
+ unittest.main(module=None, argv=argv, **kwargs)
else:
- unittest.main(defaultTest="all", argv=argv)
+ unittest.main(defaultTest="all", argv=argv, **kwargs)
except SystemExit, e:
if e.code == 0:
logging.info('PASS')

0 comments on commit 3ae8915

Please sign in to comment.