diff options
author | Amber Brown <hawkowl@atleastfornow.net> | 2018-06-22 09:37:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-22 09:37:10 +0100 |
commit | 77ac14b960cb8daef76062ce85fc0427749b48af (patch) | |
tree | 4a2b3af0e0404640a2ef251030cd3c2591a1d6ba /tests/util/test_logcontext.py | |
parent | Populate synapse_federation_client_sent_pdu_destinations:count again (#3386) (diff) | |
download | synapse-77ac14b960cb8daef76062ce85fc0427749b48af.tar.xz |
Pass around the reactor explicitly (#3385)
Diffstat (limited to 'tests/util/test_logcontext.py')
-rw-r--r-- | tests/util/test_logcontext.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/tests/util/test_logcontext.py b/tests/util/test_logcontext.py index ad78d884e0..9cf90fcfc4 100644 --- a/tests/util/test_logcontext.py +++ b/tests/util/test_logcontext.py @@ -3,8 +3,7 @@ from twisted.internet import defer from twisted.internet import reactor from .. import unittest -from synapse.util.async import sleep -from synapse.util import logcontext +from synapse.util import logcontext, Clock from synapse.util.logcontext import LoggingContext @@ -22,18 +21,20 @@ class LoggingContextTestCase(unittest.TestCase): @defer.inlineCallbacks def test_sleep(self): + clock = Clock(reactor) + @defer.inlineCallbacks def competing_callback(): with LoggingContext() as competing_context: competing_context.request = "competing" - yield sleep(0) + yield clock.sleep(0) self._check_test_key("competing") reactor.callLater(0, competing_callback) with LoggingContext() as context_one: context_one.request = "one" - yield sleep(0) + yield clock.sleep(0) self._check_test_key("one") def _test_run_in_background(self, function): @@ -87,7 +88,7 @@ class LoggingContextTestCase(unittest.TestCase): def test_run_in_background_with_blocking_fn(self): @defer.inlineCallbacks def blocking_function(): - yield sleep(0) + yield Clock(reactor).sleep(0) return self._test_run_in_background(blocking_function) |