Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
test_message_summary: Fix failing tests.
Aman Agrawal7e16a4e778d5
diff --git a/zerver/tests/test_message_summary.py b/zerver/tests/test_message_summary.pyindex ab1c68e7e97..9dccff58cfd 100644--- a/zerver/tests/test_message_summary.py+++ b/zerver/tests/test_message_summary.py@@ -1,8 +1,10 @@import osimport warnings+from datetime import datetime, timezonefrom unittest import mockimport orjson+import time_machinefrom django.conf import settingsfrom typing_extensions import override@@ -44,12 +46,19 @@ class MessagesSummaryTestCase(ZulipTestCase):self.user, self.channel_name, content=content, topic_name=self.topic_name)+ # Tests fail on the last day of the month due to us capturing the credit usage for that day+ # on the first of the next month, so we need to set the date to a different day.+ not_last_day_of_any_month = datetime(2025, 2, 18, 1, tzinfo=timezone.utc)++ self.mocked_time_patcher = time_machine.travel(not_last_day_of_any_month, tick=False)+ self.mocked_time_patcher.start()if settings.GENERATE_LITELLM_FIXTURES: # nocoverageself.patcher = mock.patch("litellm.completion", wraps=litellm.completion)self.mocked_completion = self.patcher.start()@overridedef tearDown(self) -> None:+ self.mocked_time_patcher.stop()if settings.GENERATE_LITELLM_FIXTURES: # nocoverageself.patcher.stop()super().tearDown()