mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	test_tornado: Fix IOLoop exceptions output spam.
We weren't quite following the proper protocol for Tornado tests.
This commit is contained in:
		@@ -178,12 +178,8 @@ class WebSocketBaseTestCase(AsyncHTTPTestCase, ZulipTestCase):
 | 
			
		||||
    def close(self, ws):
 | 
			
		||||
        # type: (Any) -> None
 | 
			
		||||
        """Close a websocket connection and wait for the server side.
 | 
			
		||||
 | 
			
		||||
        If we don't wait here, there are sometimes leak warnings in the
 | 
			
		||||
        tests.
 | 
			
		||||
        """
 | 
			
		||||
        ws.close()
 | 
			
		||||
        self.wait()
 | 
			
		||||
 | 
			
		||||
class TornadoTestCase(WebSocketBaseTestCase):
 | 
			
		||||
    @override_settings(DEBUG=False)
 | 
			
		||||
@@ -305,7 +301,7 @@ class TornadoTestCase(WebSocketBaseTestCase):
 | 
			
		||||
        ws = yield self.ws_connect('/sockjs/366/v8nw22qe/websocket', cookie_header=cookie_header)
 | 
			
		||||
        response = yield ws.read_message()
 | 
			
		||||
        self.assertEqual(response, 'o')
 | 
			
		||||
        self.close(ws)
 | 
			
		||||
        yield self.close(ws)
 | 
			
		||||
 | 
			
		||||
    @gen_test
 | 
			
		||||
    def test_tornado_auth(self):
 | 
			
		||||
@@ -339,7 +335,7 @@ class TornadoTestCase(WebSocketBaseTestCase):
 | 
			
		||||
                 },
 | 
			
		||||
                 "type": "response"}
 | 
			
		||||
            ])
 | 
			
		||||
        self.close(ws)
 | 
			
		||||
        yield self.close(ws)
 | 
			
		||||
 | 
			
		||||
    @gen_test
 | 
			
		||||
    def test_sending_private_message(self):
 | 
			
		||||
@@ -374,7 +370,7 @@ class TornadoTestCase(WebSocketBaseTestCase):
 | 
			
		||||
        ack_resp = yield ws.read_message()
 | 
			
		||||
        msg_resp = yield ws.read_message()
 | 
			
		||||
        self._check_message_sending(request_id, ack_resp, msg_resp, user_profile, queue_events_data)
 | 
			
		||||
        self.close(ws)
 | 
			
		||||
        yield self.close(ws)
 | 
			
		||||
 | 
			
		||||
    @gen_test
 | 
			
		||||
    def test_sending_stream_message(self):
 | 
			
		||||
@@ -409,4 +405,4 @@ class TornadoTestCase(WebSocketBaseTestCase):
 | 
			
		||||
        ack_resp = yield ws.read_message()
 | 
			
		||||
        msg_resp = yield ws.read_message()
 | 
			
		||||
        self._check_message_sending(request_id, ack_resp, msg_resp, user_profile, queue_events_data)
 | 
			
		||||
        self.close(ws)
 | 
			
		||||
        yield self.close(ws)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user