From e4fb2883b4a9cce720d6cc773fa17f05eb489532 Mon Sep 17 00:00:00 2001 From: Dinesh Date: Mon, 26 Jul 2021 22:29:34 +0530 Subject: [PATCH] populate_db: Re-enable push_notifications logger. We were disabling push_notifications logger but weren't enabling it back. This caused failures on porting logging mocks to assertLogs as assertLogs expects a log to be generated. See 9c224ccdd392ca29bcca4277f7a94393f5be3cb6 for why we disable these. (To avoid logs spam from push_notifications_logger) --- zilencer/management/commands/populate_db.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/zilencer/management/commands/populate_db.py b/zilencer/management/commands/populate_db.py index 79c1b32f44..c7fd1dc2e0 100644 --- a/zilencer/management/commands/populate_db.py +++ b/zilencer/management/commands/populate_db.py @@ -118,10 +118,6 @@ def clear_database() -> None: Session.objects.all().delete() -# Suppress spammy output from the push notifications logger -push_notifications_logger.disabled = True - - def subscribe_users_to_streams(realm: Realm, stream_dict: Dict[str, Dict[str, Any]]) -> None: subscriptions_to_add = [] event_time = timezone_now() @@ -273,6 +269,9 @@ class Command(BaseCommand): ) def handle(self, **options: Any) -> None: + # Suppress spammy output from the push notifications logger + push_notifications_logger.disabled = True + if options["percent_huddles"] + options["percent_personals"] > 100: self.stderr.write("Error! More than 100% of messages allocated.\n") return @@ -899,6 +898,8 @@ class Command(BaseCommand): mark_all_messages_as_read() self.stdout.write("Successfully populated test database.\n") + push_notifications_logger.disabled = False + def mark_all_messages_as_read() -> None: """