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

Method setUp

tornado/testing.py:146–162  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

144 self._test_generator = None # type: Optional[Union[Generator, Coroutine]]
145
146 def setUp(self) -> None:
147 py_ver = sys.version_info
148 if ((3, 10, 0) <= py_ver < (3, 10, 9)) or ((3, 11, 0) <= py_ver <= (3, 11, 1)):
149 # Early releases in the Python 3.10 and 3.1 series had deprecation
150 # warnings that were later reverted; we must suppress them here.
151 setup_with_context_manager(self, warnings.catch_warnings())
152 warnings.filterwarnings(
153 "ignore",
154 message="There is no current event loop",
155 category=DeprecationWarning,
156 module=r"tornado\..*",
157 )
158 super().setUp()
159 if type(self).get_new_ioloop is not AsyncTestCase.get_new_ioloop:
160 warnings.warn("get_new_ioloop is deprecated", DeprecationWarning)
161 self.io_loop = self.get_new_ioloop()
162 asyncio.set_event_loop(self.io_loop.asyncio_loop) # type: ignore[attr-defined]
163
164 def tearDown(self) -> None:
165 # Native coroutines tend to produce warnings if they're not

Callers 1

setUpMethod · 0.45

Calls 2

get_new_ioloopMethod · 0.95

Tested by

no test coverage detected