]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Add additional command-line arguments to tornado.testing.main
authorBen Darnell <ben@bendarnell.com>
Mon, 10 Sep 2012 01:55:47 +0000 (18:55 -0700)
committerBen Darnell <ben@bendarnell.com>
Mon, 10 Sep 2012 01:55:47 +0000 (18:55 -0700)
tornado/testing.py
website/sphinx/releases/next.rst

index 966c860642a1e70ba4775b28cc2ad8d1579de81e..be507d38c9546e9226fb54038e6fee5f5b3db1fb 100644 (file)
@@ -461,6 +461,14 @@ def main(**kwargs):
                  "exception.  This prints a stack trace but cannot interrupt "
                  "certain operations.  If false, the process is more reliably "
                  "killed, but does not print a stack trace."))
+
+    # support the same options as unittest's command-line interface
+    define('verbose', type=bool)
+    define('quiet', type=bool)
+    define('failfast', type=bool)
+    define('catch', type=bool)
+    define('buffer', type=bool)
+
     argv = [sys.argv[0]] + parse_command_line(sys.argv)
 
     if options.httpclient:
@@ -470,6 +478,17 @@ def main(**kwargs):
     if not options.exception_on_interrupt:
         signal.signal(signal.SIGINT, signal.SIG_DFL)
 
+    if options.verbose is not None:
+        kwargs['verbosity'] = 2
+    if options.quiet is not None:
+        kwargs['verbosity'] = 0
+    if options.failfast is not None:
+        kwargs['failfast'] = True
+    if options.catch is not None:
+        kwargs['catchbreak'] = True
+    if options.buffer is not None:
+        kwargs['buffer'] = True
+
     if __name__ == '__main__' and len(argv) == 1:
         print >> sys.stderr, "No tests specified"
         sys.exit(1)
index e851a47ea91f2769f7a4101cf39d06ca4c36b427..35d110acb7967722db9143ac2bda0a218ba9b89a 100644 (file)
@@ -24,3 +24,6 @@ In progress
   unnecessary.
 * `tornado.testing.ExpectLog` can be used as a finer-grained alternative
   to `tornado.testing.LogTrapTestCase`
+* The command-line interface to `tornado.testing.main` now supports
+  additional arguments from the underlying `unittest` module:
+  ``verbose``, ``quiet``, ``failfast``, ``catch``, ``buffer``.