mirror of
https://github.com/zulip/zulip.git
synced 2025-11-14 10:57:58 +00:00
docs: Tweak some documentation around send_event.
This commit is contained in:
@@ -2052,11 +2052,18 @@ class ZulipTestCase(ZulipTestCaseMixin, TestCase):
|
||||
# So explicitly change parameter name to 'notice' to work around this problem
|
||||
with (
|
||||
mock.patch("zerver.tornado.event_queue.process_notification", lst.append),
|
||||
# Some `send_event_rollback_unsafe` calls need to be executed only after the
|
||||
# current transaction commits (using `on_commit` hooks). Because the transaction
|
||||
# in Django tests never commits (rather, gets rolled back after the test completes),
|
||||
# such events would never be sent in tests, and we would be unable to verify them.
|
||||
# Hence, we use this helper to make sure the `send_event_rollback_unsafe` calls actually run.
|
||||
# Some `send_event_rollback_unsafe` calls need to be
|
||||
# executed only after the current transaction commits
|
||||
# (mainly those using the `send_event_on_commit` wrapper, which
|
||||
# sends the actual event inside an `on_commit` hook).
|
||||
#
|
||||
# Because the outer transaction in Django tests never
|
||||
# commits (it gets rolled back when the test completes
|
||||
# to restore the database to the desired state for the
|
||||
# next test), such events would never be sent in
|
||||
# tests, and we would be unable to verify them.
|
||||
# Hence, we use this helper to make sure the
|
||||
# `send_event_rollback_unsafe` calls actually run.
|
||||
self.captureOnCommitCallbacks(execute=True),
|
||||
):
|
||||
yield lst
|
||||
|
||||
Reference in New Issue
Block a user