MCPcopy
hub / github.com/tornadoweb/tornado / main

Function main

tornado/test/runtests.py:126–219  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

124
125
126def main():
127 # Be strict about most warnings (This is set in our test running
128 # scripts to catch import-time warnings, but set it again here to
129 # be sure). This also turns on warnings that are ignored by
130 # default, including DeprecationWarnings and python 3.2's
131 # ResourceWarnings.
132 warnings.filterwarnings("error")
133 # setuptools sometimes gives ImportWarnings about things that are on
134 # sys.path even if they're not being used.
135 warnings.filterwarnings("ignore", category=ImportWarning)
136 # Tornado generally shouldn't use anything deprecated, but some of
137 # our dependencies do (last match wins).
138 warnings.filterwarnings("ignore", category=DeprecationWarning)
139 warnings.filterwarnings("error", category=DeprecationWarning, module=r"tornado\..*")
140 warnings.filterwarnings("ignore", category=PendingDeprecationWarning)
141 warnings.filterwarnings(
142 "error", category=PendingDeprecationWarning, module=r"tornado\..*"
143 )
144
145 logging.getLogger("tornado.access").setLevel(logging.CRITICAL)
146
147 define(
148 "httpclient",
149 type=str,
150 default=None,
151 callback=lambda s: AsyncHTTPClient.configure(
152 s, defaults=dict(allow_ipv6=False)
153 ),
154 )
155 define("httpserver", type=str, default=None, callback=HTTPServer.configure)
156 define("resolver", type=str, default=None, callback=Resolver.configure)
157 define(
158 "debug_gc",
159 type=str,
160 multiple=True,
161 help="A comma-separated list of gc module debug constants, "
162 "e.g. DEBUG_STATS or DEBUG_COLLECTABLE,DEBUG_OBJECTS",
163 callback=lambda values: gc.set_debug(
164 reduce(operator.or_, (getattr(gc, v) for v in values))
165 ),
166 )
167 define(
168 "fail-if-logs",
169 default=True,
170 help="If true, fail the tests if any log output is produced (unless captured by ExpectLog)",
171 )
172
173 def set_locale(x):
174 locale.setlocale(locale.LC_ALL, x)
175
176 define("locale", type=str, default=None, callback=set_locale)
177
178 log_counter = LogCounter()
179 add_parse_callback(lambda: logging.getLogger().handlers[0].addFilter(log_counter))
180
181 # Certain errors (especially "unclosed resource" errors raised in
182 # destructors) go directly to stderr instead of logging. Count
183 # anything written by anything but the test runner as an error.

Callers 3

__main__.pyFile · 0.90
runtests.pyFile · 0.70
test_run_on_executorMethod · 0.70

Calls 7

defineFunction · 0.90
add_parse_callbackFunction · 0.90
LogCounterClass · 0.85
CountingStderrClass · 0.85
test_runner_factoryFunction · 0.85
mainMethod · 0.80
configureMethod · 0.45

Tested by

no test coverage detected