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

Method test_import

tornado/test/netutil_test.py:135–152  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

133@unittest.skipIf(sys.platform == "win32", "preexec_fn not available on win32")
134class ThreadedResolverImportTest(unittest.TestCase):
135 def test_import(self):
136 TIMEOUT = 5
137
138 # Test for a deadlock when importing a module that runs the
139 # ThreadedResolver at import-time. See resolve_test.py for
140 # full explanation.
141 command = [sys.executable, "-c", "import tornado.test.resolve_test_helper"]
142
143 start = time.time()
144 popen = Popen(command, preexec_fn=lambda: signal.alarm(TIMEOUT))
145 while time.time() - start < TIMEOUT:
146 return_code = popen.poll()
147 if return_code is not None:
148 self.assertEqual(0, return_code)
149 return # Success.
150 time.sleep(0.05)
151
152 self.fail("import timed out")
153
154
155# We do not test errors with CaresResolver:

Callers

nothing calls this directly

Calls 1

timeMethod · 0.80

Tested by

no test coverage detected