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

Method tearDown

tornado/test/httpclient_test.py:891–914  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

889 self.http_client = HTTPClient()
890
891 def tearDown(self):
892 def stop_server():
893 self.server.stop()
894 # Delay the shutdown of the IOLoop by several iterations because
895 # the server may still have some cleanup work left when
896 # the client finishes with the response (this is noticeable
897 # with http/2, which leaves a Future with an unexamined
898 # StreamClosedError on the loop).
899
900 @gen.coroutine
901 def slow_stop():
902 yield self.server.close_all_connections()
903 # The number of iterations is difficult to predict. Typically,
904 # one is sufficient, although sometimes it needs more.
905 for i in range(5):
906 yield
907 self.server_ioloop.stop()
908
909 self.server_ioloop.add_callback(slow_stop)
910
911 self.server_ioloop.add_callback(stop_server)
912 self.server_thread.join()
913 self.http_client.close()
914 self.server_ioloop.close(all_fds=True)
915
916 def get_url(self, path):
917 return "http://127.0.0.1:%d%s" % (self.port, path)

Callers

nothing calls this directly

Calls 3

joinMethod · 0.80
add_callbackMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected