Commit 642b59c2 authored by Vincent Pelletier's avatar Vincent Pelletier

test: Always clear wait event in UntilEvent when it occurred.

So the instance is readily reusable and less likely to be misused.
parent 4e126969
...@@ -182,16 +182,14 @@ class UntilEvent(object): ...@@ -182,16 +182,14 @@ class UntilEvent(object):
raise ValueError # pragma: no cover raise ValueError # pragma: no cover
self._action = value self._action = value
def wait(self, timeout=10, clear=False): def wait(self, timeout=10):
""" """
Wait for event to be waited upon at least once. Wait for event to be waited upon at least once.
timeout (float) timeout (float)
Maximum number of seconds to wait for. Maximum number of seconds to wait for.
clear (bool)
Whether to reset this flag once reached.
""" """
result = self._wait_event.wait(timeout) result = self._wait_event.wait(timeout)
if result and clear: if result:
self._wait_event.clear() self._wait_event.clear()
return result return result
...@@ -1951,7 +1949,7 @@ class CaucaseTest(unittest.TestCase): ...@@ -1951,7 +1949,7 @@ class CaucaseTest(unittest.TestCase):
updater_thread.daemon = True updater_thread.daemon = True
updater_thread.start() updater_thread.start()
try: try:
self.assertTrue(until_updater.wait(clear=True)) self.assertTrue(until_updater.wait())
# CSR must have been submitted # CSR must have been submitted
csr_line_list = self._runClient( csr_line_list = self._runClient(
'--user-key', user_key_path, '--user-key', user_key_path,
......
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