summary refs log tree commit diff
path: root/tests/utils.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-09-23 13:56:14 +0100
committerErik Johnston <erik@matrix.org>2016-09-23 14:00:52 +0100
commit22578545a05944284eab3ba7646e2c1c5c36e359 (patch)
tree2495932e4cf5e3296fcfd34f90f54f4da70ff65a /tests/utils.py
parentMerge pull request #1136 from matrix-org/erikj/fix_signed_3pid (diff)
downloadsynapse-22578545a05944284eab3ba7646e2c1c5c36e359.tar.xz
Time out typing over federation
Diffstat (limited to '')
-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.)