From: Ben Darnell Date: Sun, 29 May 2011 21:02:27 +0000 (-0700) Subject: Make tornado.testing.main with no arguments work in python 3.2 X-Git-Tag: v2.0.0~54 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=05fd0fcb2a7f3deda9ed1823ea44670dabff29e4;p=thirdparty%2Ftornado.git Make tornado.testing.main with no arguments work in python 3.2 --- diff --git a/tornado/testing.py b/tornado/testing.py index 1b6ee9af0..fa9113964 100644 --- a/tornado/testing.py +++ b/tornado/testing.py @@ -342,9 +342,14 @@ def main(): try: # In order to be able to run tests by their fully-qualified name # on the command line without importing all tests here, - # module must be set to None (in which case the defaultTest must - # also be fully-qualified - unittest.main(module=None, defaultTest='__main__.all', argv=argv) + # module must be set to None. Python 3.2's unittest.main ignores + # defaultTest if no module is given (it tries to do its own + # 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) + else: + unittest.main(defaultTest="all", argv=argv) except SystemExit, e: if e.code == 0: logging.info('PASS')