diff options
author | Paul "LeoNerd" Evans <paul@matrix.org> | 2014-12-10 19:26:52 +0000 |
---|---|---|
committer | Paul "LeoNerd" Evans <paul@matrix.org> | 2014-12-10 19:26:52 +0000 |
commit | 4551afc6d2f69ae3aa0ac37217fa0a94c0b2d62a (patch) | |
tree | 6de7abc773b722ea30bb380862c92b69fa84c313 /tests/utils.py | |
parent | Implement .call_later() in MockClock (diff) | |
download | synapse-4551afc6d2f69ae3aa0ac37217fa0a94c0b2d62a.tar.xz |
Implement .cancel_call_later() in MockClock
Diffstat (limited to '')
-rw-r--r-- | tests/utils.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/utils.py b/tests/utils.py index 72843714fd..f9a34748cd 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -152,10 +152,13 @@ class MockClock(object): def wrapped_callback(): LoggingContext.thread_local.current_context = current_context callback() - self.timers.append((self.now + delay, wrapped_callback)) + + t = (self.now + delay, wrapped_callback) + self.timers.append(t) + return t def cancel_call_later(self, timer): - raise NotImplementedError("Oopsie") + self.timers = [t for t in self.timers if t != timer] # For unit testing def advance_time(self, secs): |