From 11390b70bec73c24159ba324cae908b548c0b319 Mon Sep 17 00:00:00 2001 From: Mateusz Mandera Date: Fri, 29 Sep 2023 17:00:28 +0200 Subject: [PATCH] tests: Eliminate instances of time_machine.travel without tick=False. None of these tests seem to want to have tick=True, which is the default. Letting the clock tick without a reason introduces the possibility of nondeterministic test failures depending on the execution time. --- zerver/tests/test_delete_unclaimed_attachments.py | 2 +- zerver/tests/test_invite.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/zerver/tests/test_delete_unclaimed_attachments.py b/zerver/tests/test_delete_unclaimed_attachments.py index f076964990..f151d2d667 100644 --- a/zerver/tests/test_delete_unclaimed_attachments.py +++ b/zerver/tests/test_delete_unclaimed_attachments.py @@ -26,7 +26,7 @@ class UnclaimedAttachmentTest(UploadSerializeMixin, ZulipTestCase): uploader = self.example_user("hamlet") self.login_user(uploader) - with time_machine.travel(when): + with time_machine.travel(when, tick=False): file_obj = StringIO("zulip!") file_obj.name = filename response = self.assert_json_success( diff --git a/zerver/tests/test_invite.py b/zerver/tests/test_invite.py index bf7ddad00d..e6915a1a24 100644 --- a/zerver/tests/test_invite.py +++ b/zerver/tests/test_invite.py @@ -335,7 +335,7 @@ class InviteUserTest(InviteUserBase): # We've sent 40 invites "today". Fast-forward 48 hours # and ensure that we can invite more people - with time_machine.travel(timezone_now() + datetime.timedelta(hours=48)): + with time_machine.travel(timezone_now() + datetime.timedelta(hours=48), tick=False): result = try_invite(5, default_realm_max=30, new_realm_max=20, realm_max=10) self.assert_json_success(result) self.check_sent_emails([f"zulip-{i:02}@zulip.com" for i in range(5)], clear=True)