tornado: Make process_notification hack avoid import loops.

This fixes a problem where we could not import zerver.lib.streams from
zerver.lib.message, which would otherwise be reasonable, because the
former implicitly imported many modules due to this issue.
This commit is contained in:
Tim Abbott
2021-09-27 16:23:25 -07:00
committed by Tim Abbott
parent 8b906b5d2f
commit 272e81988b
2 changed files with 12 additions and 2 deletions

View File

@@ -1329,7 +1329,7 @@ Output:
# so mypy doesn't allow assigning lst.append to process_notification
# So explicitly change parameter name to 'notice' to work around this problem
with mock.patch(
"zerver.tornado.django_api.process_notification", lambda notice: lst.append(notice)
"zerver.tornado.event_queue.process_notification", lambda notice: lst.append(notice)
):
# Some `send_event` calls need to be executed only after the current transaction
# commits (using `on_commit` hooks). Because the transaction in Django tests never