Commit b22a50a8 authored by Vincent Pelletier's avatar Vincent Pelletier

tests: Clarify UntilEvent.__call__

The code could actually not loop. Still check that deadline is not reached
when entering, as code often uses "now" as initial deadline.
Also, clarify dosctring.
parent 35fc8b2e
......@@ -195,11 +195,12 @@ class UntilEvent(object):
def __call__(self, deadline):
"""
Sleep until deadline is reached or self._event is set.
Raises utils.SleepInterrupt if self._event is set.
Sleep until event is set, then
- if self.action is ON_EVENT_RAISE, raises utils.SleepInterrupt.
- if self.action is ON_EVENT_EXPIRE, deadline time it returned.
"""
now = datetime.datetime.utcnow()
while now < deadline:
if now < deadline:
self._wait_event.set()
assert self._event.wait(10)
self._event.clear()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment