resolve_test_helper.py 411 B

12345678910
  1. from tornado.ioloop import IOLoop
  2. from tornado.netutil import ThreadedResolver
  3. # When this module is imported, it runs getaddrinfo on a thread. Since
  4. # the hostname is unicode, getaddrinfo attempts to import encodings.idna
  5. # but blocks on the import lock. Verify that ThreadedResolver avoids
  6. # this deadlock.
  7. resolver = ThreadedResolver()
  8. IOLoop.current().run_sync(lambda: resolver.resolve(u"localhost", 80))