Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Fix a couple of logcontext leaks in unit tests
Browse files Browse the repository at this point in the history
... which were making other, innocent, tests, fail.

Plus remove a spurious unittest.DEBUG which was making the output noisy.
  • Loading branch information
richvdh committed May 2, 2018
1 parent a8d8bf9 commit 46beeb9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
11 changes: 9 additions & 2 deletions tests/appservice/test_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
_ServiceQueuer, _TransactionController, _Recoverer
)
from twisted.internet import defer

from synapse.util.logcontext import make_deferred_yieldable
from ..utils import MockClock
from mock import Mock
from tests import unittest
Expand Down Expand Up @@ -204,7 +206,9 @@ def test_send_single_event_no_queue(self):

def test_send_single_event_with_queue(self):
d = defer.Deferred()
self.txn_ctrl.send = Mock(return_value=d)
self.txn_ctrl.send = Mock(
side_effect=lambda x, y: make_deferred_yieldable(d),
)
service = Mock(id=4)
event = Mock(event_id="first")
event2 = Mock(event_id="second")
Expand Down Expand Up @@ -235,7 +239,10 @@ def test_multiple_service_queues(self):
srv_2_event2 = Mock(event_id="srv2b")

send_return_list = [srv_1_defer, srv_2_defer]
self.txn_ctrl.send = Mock(side_effect=lambda x, y: send_return_list.pop(0))

def do_send(x, y):
return make_deferred_yieldable(send_return_list.pop(0))
self.txn_ctrl.send = Mock(side_effect=do_send)

# send events for different ASes and make sure they are sent
self.queuer.enqueue(srv1, srv_1_event)
Expand Down
1 change: 0 additions & 1 deletion tests/storage/test_event_push_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ def _mark_read(stream, depth):
yield _rotate(10)
yield _assert_counts(1, 1)

@tests.unittest.DEBUG
@defer.inlineCallbacks
def test_find_first_stream_ordering_after_ts(self):
def add_event(so, ts):
Expand Down

0 comments on commit 46beeb9

Please sign in to comment.