mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	test_tornado: Fix leaking of event queue state.
Apparently, we weren't calling the proper clear functions inside the Tornado tests, which resulted in unexpected behavior in other tests that were relying on the Tornado event queue system being empty. (In this case, a new test for mobile push notifications that assumed receiver_is_off_zulip() was always true failed after this was run).
This commit is contained in:
		@@ -50,6 +50,8 @@ class TornadoWebTestCase(AsyncHTTPTestCase, ZulipTestCase):
 | 
			
		||||
    def tearDown(self) -> None:
 | 
			
		||||
        super().tearDown()
 | 
			
		||||
        self.session_cookie = None  # type: Optional[Dict[str, str]]
 | 
			
		||||
        # Important: we need to clear event queues to avoid leaking data to future tests.
 | 
			
		||||
        event_queue.clear_client_event_queues_for_testing()
 | 
			
		||||
 | 
			
		||||
    @override_settings(DEBUG=False)
 | 
			
		||||
    def get_app(self) -> Application:
 | 
			
		||||
@@ -149,6 +151,8 @@ class WebSocketBaseTestCase(AsyncHTTPTestCase, ZulipTestCase):
 | 
			
		||||
    def tearDown(self) -> None:
 | 
			
		||||
        super().tearDown()
 | 
			
		||||
        settings.RUNNING_INSIDE_TORNADO = False
 | 
			
		||||
        # Important: we need to clear event queues to avoid leaking data to future tests.
 | 
			
		||||
        event_queue.clear_client_event_queues_for_testing()
 | 
			
		||||
 | 
			
		||||
    @gen.coroutine
 | 
			
		||||
    def ws_connect(self, path: str, cookie_header: str,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user