diff options
author | Richard van der Hoff <richard@matrix.org> | 2018-07-12 09:56:28 +0100 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2018-07-12 09:56:28 +0100 |
commit | 482d17b58b55e4a62c1b4df9484d1c3af80d94ff (patch) | |
tree | d936edf00491834d76c7c7aa651d2f884e0c307b /tests/util/test_logcontext.py | |
parent | Enforce the specified API for report_event (diff) | |
parent | Merge pull request #3505 from matrix-org/erikj/receipts_cahce (diff) | |
download | synapse-482d17b58b55e4a62c1b4df9484d1c3af80d94ff.tar.xz |
Merge branch 'develop' into rav/enforce_report_api
Diffstat (limited to 'tests/util/test_logcontext.py')
-rw-r--r-- | tests/util/test_logcontext.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/tests/util/test_logcontext.py b/tests/util/test_logcontext.py index ad78d884e0..c54001f7a4 100644 --- a/tests/util/test_logcontext.py +++ b/tests/util/test_logcontext.py @@ -1,12 +1,11 @@ import twisted.python.failure -from twisted.internet import defer -from twisted.internet import reactor -from .. import unittest +from twisted.internet import defer, reactor -from synapse.util.async import sleep -from synapse.util import logcontext +from synapse.util import Clock, logcontext from synapse.util.logcontext import LoggingContext +from .. import unittest + class LoggingContextTestCase(unittest.TestCase): @@ -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) |