From 52c45c00fe0bbc52cccdea0048193cc6beba853c Mon Sep 17 00:00:00 2001 From: Ben Darnell Date: Fri, 7 Aug 2020 12:26:10 -0400 Subject: [PATCH] test: Add an option to disable assertion that logs are empty Use this on windows due to a log spam issue in asyncio. --- appveyor.yml | 3 ++- tornado/test/runtests.py | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 732a70437..273eb192c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -60,7 +60,8 @@ environment: PYTHON_VERSION: "3.8.x" PYTHON_ARCH: "64" TOX_ENV: "py38" - TOX_ARGS: "" + # Suppress the log-cleanliness assertions because of https://bugs.python.org/issue39010 + TOX_ARGS: "--fail-if-logs=false" install: # Make sure the right python version is first on the PATH. diff --git a/tornado/test/runtests.py b/tornado/test/runtests.py index 43cdf4d91..484eb9625 100644 --- a/tornado/test/runtests.py +++ b/tornado/test/runtests.py @@ -12,7 +12,7 @@ import warnings from tornado.httpclient import AsyncHTTPClient from tornado.httpserver import HTTPServer from tornado.netutil import Resolver -from tornado.options import define, add_parse_callback +from tornado.options import define, add_parse_callback, options TEST_MODULES = [ @@ -182,6 +182,11 @@ def main(): reduce(operator.or_, (getattr(gc, v) for v in values)) ), ) + define( + "fail-if-logs", + default=True, + help="If true, fail the tests if any log output is produced (unless captured by ExpectLog)", + ) def set_locale(x): locale.setlocale(locale.LC_ALL, x) @@ -228,7 +233,8 @@ def main(): log_counter.error_count, counting_stderr.byte_count, ) - sys.exit(1) + if options.fail_if_logs: + sys.exit(1) if __name__ == "__main__": -- 2.47.2