MCPcopy Create free account
hub / github.com/EasyIME/PIME / tearDown

Method tearDown

python/python3/tornado/test/httpclient_test.py:794–817  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

792 self.http_client = HTTPClient()
793
794 def tearDown(self):
795 def stop_server():
796 self.server.stop()
797 # Delay the shutdown of the IOLoop by several iterations because
798 # the server may still have some cleanup work left when
799 # the client finishes with the response (this is noticeable
800 # with http/2, which leaves a Future with an unexamined
801 # StreamClosedError on the loop).
802
803 @gen.coroutine
804 def slow_stop():
805 yield self.server.close_all_connections()
806 # The number of iterations is difficult to predict. Typically,
807 # one is sufficient, although sometimes it needs more.
808 for i in range(5):
809 yield
810 self.server_ioloop.stop()
811
812 self.server_ioloop.add_callback(slow_stop)
813
814 self.server_ioloop.add_callback(stop_server)
815 self.server_thread.join()
816 self.http_client.close()
817 self.server_ioloop.close(all_fds=True)
818
819 def get_url(self, path):
820 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