New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace remaining logging mocks with assertLogs. #19392
Conversation
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 9c224cc for why we disable these. (To avoid logs spam from push_notifications_logger)
Left the mocks which are used to assert a logging call isn't made.
Hello @chdinesh1089, it seems like you have referenced #15331 in your pull request description, but you have not referenced them in your commit message description(s). When you reference an issue in a commit message, it automatically closes the corresponding issue when the commit is merged. Please run An example of a correctly-formatted commit:
Thank you for your contributions to Zulip! |
Set level to 'ERROR' since exceptions create logs with that level.
Of the two other logging mocks left in this file, one checks a logging call isn't made and another makes sure errors aren't allowed by raising an exception as a side_effect to the logger.
@@ -899,6 +898,8 @@ def handle(self, **options: Any) -> None: | |||
mark_all_messages_as_read() | |||
self.stdout.write("Successfully populated test database.\n") | |||
|
|||
push_notifications_logger.disabled = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think probably the important part is just moving this out of the top level, so that importing this file doesn't result in that change occurring.
This is awesome, merged, thanks @chdinesh1089! |
Closes #15331
I think this completes the migration of logging mocks to
assertLogs
. The ones left are either used to assert a logging call isn't made, or some sort of strategic mocking like this, or somehow necessary for eg. to checkstack_info
is setTrue
.