mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +00:00
tests: Move clear_client_event_queues_for_testing to ZulipTestCase.
Following recent testing flakes that were traced down to this not having been called causing `receiver_is_off_zulip` to depend on test ordering, it makes sense to centralize this. I think it should always have been in ZulipTestCase; it appears the reason it wasn't from the beginning was that originally only test_events.py interacted with it, and do_test there still needs to call this directly (because it can be called multiple times within a single test). And then we did the wrong thing as expanded use of Tornado event_queue code in tests to more of the codebase.
This commit is contained in:
@@ -50,8 +50,6 @@ 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:
|
||||
@@ -143,7 +141,6 @@ class EventsTestCase(TornadoWebTestCase):
|
||||
self.assertEqual(data['result'], 'success')
|
||||
|
||||
class WebSocketBaseTestCase(AsyncHTTPTestCase, ZulipTestCase):
|
||||
|
||||
def setUp(self) -> None:
|
||||
settings.RUNNING_INSIDE_TORNADO = True
|
||||
super().setUp()
|
||||
@@ -151,8 +148,6 @@ 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