()
| 111 | |
| 112 | |
| 113 | def main(): |
| 114 | # Be strict about most warnings (This is set in our test running |
| 115 | # scripts to catch import-time warnings, but set it again here to |
| 116 | # be sure). This also turns on warnings that are ignored by |
| 117 | # default, including DeprecationWarnings and python 3.2's |
| 118 | # ResourceWarnings. |
| 119 | warnings.filterwarnings("error") |
| 120 | # setuptools sometimes gives ImportWarnings about things that are on |
| 121 | # sys.path even if they're not being used. |
| 122 | warnings.filterwarnings("ignore", category=ImportWarning) |
| 123 | # Tornado generally shouldn't use anything deprecated, but some of |
| 124 | # our dependencies do (last match wins). |
| 125 | warnings.filterwarnings("ignore", category=DeprecationWarning) |
| 126 | warnings.filterwarnings("error", category=DeprecationWarning, module=r"tornado\..*") |
| 127 | warnings.filterwarnings("ignore", category=PendingDeprecationWarning) |
| 128 | warnings.filterwarnings( |
| 129 | "error", category=PendingDeprecationWarning, module=r"tornado\..*" |
| 130 | ) |
| 131 | # The unittest module is aggressive about deprecating redundant methods, |
| 132 | # leaving some without non-deprecated spellings that work on both |
| 133 | # 2.7 and 3.2 |
| 134 | warnings.filterwarnings( |
| 135 | "ignore", category=DeprecationWarning, message="Please use assert.* instead" |
| 136 | ) |
| 137 | warnings.filterwarnings( |
| 138 | "ignore", |
| 139 | category=PendingDeprecationWarning, |
| 140 | message="Please use assert.* instead", |
| 141 | ) |
| 142 | # Twisted 15.0.0 triggers some warnings on py3 with -bb. |
| 143 | warnings.filterwarnings("ignore", category=BytesWarning, module=r"twisted\..*") |
| 144 | if (3,) < sys.version_info < (3, 6): |
| 145 | # Prior to 3.6, async ResourceWarnings were rather noisy |
| 146 | # and even |
| 147 | # `python3.4 -W error -c 'import asyncio; asyncio.get_event_loop()'` |
| 148 | # would generate a warning. |
| 149 | warnings.filterwarnings( |
| 150 | "ignore", category=ResourceWarning, module=r"asyncio\..*" |
| 151 | ) |
| 152 | # This deprecation warning is introduced in Python 3.8 and is |
| 153 | # triggered by pycurl. Unforunately, because it is raised in the C |
| 154 | # layer it can't be filtered by module and we must match the |
| 155 | # message text instead (Tornado's C module uses PY_SSIZE_T_CLEAN |
| 156 | # so it's not at risk of running into this issue). |
| 157 | warnings.filterwarnings( |
| 158 | "ignore", |
| 159 | category=DeprecationWarning, |
| 160 | message="PY_SSIZE_T_CLEAN will be required", |
| 161 | ) |
| 162 | |
| 163 | logging.getLogger("tornado.access").setLevel(logging.CRITICAL) |
| 164 | |
| 165 | define( |
| 166 | "httpclient", |
| 167 | type=str, |
| 168 | default=None, |
| 169 | callback=lambda s: AsyncHTTPClient.configure( |
| 170 | s, defaults=dict(allow_ipv6=False) |
no test coverage detected