# Path: tornado/log.py
# def _stderr_supports_color():
#     def __init__(self, color=True, *args, **kwargs):
#     def format(self, record):
# def enable_pretty_logging(options=None):
# def define_logging_options(options=None):
# class LogFormatter(logging.Formatter):
# 
# Path: tornado/stack_context.py
# class ExceptionStackContext(object):
#     '''Specialization of StackContext for exception handling.
# 
#     The supplied exception_handler function will be called in the
#     event of an uncaught exception in this context.  The semantics are
#     similar to a try/finally clause, and intended use cases are to log
#     an error, close a socket, or similar cleanup actions.  The
#     exc_info triple (type, value, traceback) will be passed to the
#     exception_handler function.
# 
#     If the exception handler returns true, the exception will be
#     consumed and will not be propagated to other exception handlers.
#     '''
#     def __init__(self, exception_handler, _active_cell=None):
#         self.exception_handler = exception_handler
#         self.active_cell = _active_cell or [True]
# 
#     def __enter__(self):
#         self.old_contexts = _state.contexts
#         _state.contexts = (self.old_contexts +
#                            ((ExceptionStackContext, self.exception_handler,
#                              self.active_cell),))
#         return lambda: operator.setitem(self.active_cell, 0, False)
# 
#     def __exit__(self, type, value, traceback):
#         try:
#             if type is not None:
#                 return self.exception_handler(type, value, traceback)
#         finally:
#             _state.contexts = self.old_contexts
#             self.old_contexts = None
# 
# Path: tornado/util.py
# def raise_exc_info(exc_info):
#     """Re-raise an exception (with original traceback) from an exc_info tuple.
# 
#     The argument is a ``(type, value, traceback)`` tuple as returned by
#     `sys.exc_info`.
#     """
#     # 2to3 isn't smart enough to convert three-argument raise
#     # statements correctly in some cases.
#     if isinstance(exc_info[1], exc_info[0]):
#         raise exc_info[1], None, exc_info[2]
#         # After 2to3: raise exc_info[1].with_traceback(exc_info[2])
#     else:
#         # I think this branch is only taken for string exceptions,
#         # which were removed in Python 2.6.
#         raise exc_info[0], exc_info[1], exc_info[2]
#         # After 2to3: raise exc_info[0](exc_info[1]).with_traceback(exc_info[2])


from cStringIO import StringIO
    from tornado.httpclient import AsyncHTTPClient
    from tornado.httpserver import HTTPServer
    from tornado.simple_httpclient import SimpleAsyncHTTPClient
    from tornado.ioloop import IOLoop
    from tornado import netutil
from tornado.log import gen_log
from tornado.stack_context import ExceptionStackContext
from tornado.util import raise_exc_info
    from tornado.options import define, options, parse_command_line
import logging
import os
import re
import signal
import socket
import sys
import time
    import unittest2 as unittest
    import unittest
    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)
    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.  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, **kwargs)
        else:
            unittest.main(defaultTest="all", argv=argv, **kwargs)
    except SystemExit, e:
        if e.code == 0:

# Path: tornado/log.py
# def _stderr_supports_color():
#     def __init__(self, color=True, *args, **kwargs):
#     def format(self, record):
# def enable_pretty_logging(options=None):
# def define_logging_options(options=None):
# class LogFormatter(logging.Formatter):
# 
# Path: tornado/stack_context.py
# class ExceptionStackContext(object):
#     '''Specialization of StackContext for exception handling.
# 
#     The supplied exception_handler function will be called in the
#     event of an uncaught exception in this context.  The semantics are
#     similar to a try/finally clause, and intended use cases are to log
#     an error, close a socket, or similar cleanup actions.  The
#     exc_info triple (type, value, traceback) will be passed to the
#     exception_handler function.
# 
#     If the exception handler returns true, the exception will be
#     consumed and will not be propagated to other exception handlers.
#     '''
#     def __init__(self, exception_handler, _active_cell=None):
#         self.exception_handler = exception_handler
#         self.active_cell = _active_cell or [True]
# 
#     def __enter__(self):
#         self.old_contexts = _state.contexts
#         _state.contexts = (self.old_contexts +
#                            ((ExceptionStackContext, self.exception_handler,
#                              self.active_cell),))
#         return lambda: operator.setitem(self.active_cell, 0, False)
# 
#     def __exit__(self, type, value, traceback):
#         try:
#             if type is not None:
#                 return self.exception_handler(type, value, traceback)
#         finally:
#             _state.contexts = self.old_contexts
#             self.old_contexts = None
# 
# Path: tornado/util.py
# def raise_exc_info(exc_info):
#     """Re-raise an exception (with original traceback) from an exc_info tuple.
# 
#     The argument is a ``(type, value, traceback)`` tuple as returned by
#     `sys.exc_info`.
#     """
#     # 2to3 isn't smart enough to convert three-argument raise
#     # statements correctly in some cases.
#     if isinstance(exc_info[1], exc_info[0]):
#         raise exc_info[1], None, exc_info[2]
#         # After 2to3: raise exc_info[1].with_traceback(exc_info[2])
#     else:
#         # I think this branch is only taken for string exceptions,
#         # which were removed in Python 2.6.
#         raise exc_info[0], exc_info[1], exc_info[2]
#         # After 2to3: raise exc_info[0](exc_info[1]).with_traceback(exc_info[2])


# Path: tornado/testing.py
from cStringIO import StringIO
    from tornado.httpclient import AsyncHTTPClient
    from tornado.httpserver import HTTPServer
    from tornado.simple_httpclient import SimpleAsyncHTTPClient
    from tornado.ioloop import IOLoop
    from tornado import netutil
from tornado.log import gen_log
from tornado.stack_context import ExceptionStackContext
from tornado.util import raise_exc_info
    from tornado.options import define, options, parse_command_line
import logging
import os
import re
import signal
import socket
import sys
import time
    import unittest2 as unittest
    import unittest

    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)
    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.  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, **kwargs)
        else:
            unittest.main(defaultTest="all", argv=argv, **kwargs)
    except SystemExit, e:
        if e.code == 0:

            gen_log.info('PASS')