diff options
author | Erik Johnston <erik@matrix.org> | 2016-10-05 14:41:07 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2016-10-05 14:41:07 +0100 |
commit | e779ee0ee21584b8907b866734376a737a8b6d2e (patch) | |
tree | cc27f059a354379346f9a21ff6b8b661a9407b65 /tests/utils.py | |
parent | Merge branch 'release-v0.18.0' of github.com:matrix-org/synapse (diff) | |
parent | Bump changelog and version (diff) | |
download | synapse-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.py | 9 |
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.) |