summary refs log tree commit diff
path: root/tests/utils.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-10-05 14:41:07 +0100
committerErik Johnston <erik@matrix.org>2016-10-05 14:41:07 +0100
commite779ee0ee21584b8907b866734376a737a8b6d2e (patch)
treecc27f059a354379346f9a21ff6b8b661a9407b65 /tests/utils.py
parentMerge branch 'release-v0.18.0' of github.com:matrix-org/synapse (diff)
parentBump changelog and version (diff)
downloadsynapse-e779ee0ee21584b8907b866734376a737a8b6d2e.tar.xz
Merge branch 'release-v0.18.1' of github.com:matrix-org/synapse v0.18.1
Diffstat (limited to 'tests/utils.py')
-rw-r--r--tests/utils.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/utils.py b/tests/utils.py
index 915b934e94..92d470cb48 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -220,6 +220,7 @@ class MockClock(object):
         # list of lists of [absolute_time, callback, expired] in no particular
         # order
         self.timers = []
+        self.loopers = []
 
     def time(self):
         return self.now
@@ -240,7 +241,7 @@ class MockClock(object):
         return t
 
     def looping_call(self, function, interval):
-        pass
+        self.loopers.append([function, interval / 1000., self.now])
 
     def cancel_call_later(self, timer, ignore_errs=False):
         if timer[2]:
@@ -269,6 +270,12 @@ class MockClock(object):
             else:
                 self.timers.append(t)
 
+        for looped in self.loopers:
+            func, interval, last = looped
+            if last + interval < self.now:
+                func()
+                looped[2] = self.now
+
     def advance_time_msec(self, ms):
         self.advance_time(ms / 1000.)