Commit 57de1342 authored by Vincent Pelletier's avatar Vincent Pelletier

caucase.test: Disable event wait timeout on caucased thread.

Otherwise, this will trigger if a test takes more than 10s to run, causing
caucased to exit prematurely, as only _stopServer triggers this event.
parent 351e3c7e
...@@ -224,12 +224,13 @@ class UntilEvent(object): ...@@ -224,12 +224,13 @@ class UntilEvent(object):
Like utils.until, but with a threading.Event replacing Like utils.until, but with a threading.Event replacing
KeyboardInterrupt as the early interruption source. KeyboardInterrupt as the early interruption source.
""" """
def __init__(self, event): def __init__(self, event, event_wait=10):
""" """
event (Event) event (Event)
Event to wait upon. Set and cleared outside this class. Event to wait upon. Set and cleared outside this class.
""" """
self._event = event self._event = event
self._event_wait = event_wait
self._action = ON_EVENT_RAISE self._action = ON_EVENT_RAISE
self._wait_event = threading.Event() self._wait_event = threading.Event()
self._wait_event.clear() self._wait_event.clear()
...@@ -282,7 +283,7 @@ class UntilEvent(object): ...@@ -282,7 +283,7 @@ class UntilEvent(object):
if now < deadline: if now < deadline:
self._deadline = deadline self._deadline = deadline
self._wait_event.set() self._wait_event.set()
assert self._event.wait(10) assert self._event.wait(self._event_wait)
self._deadline = None self._deadline = None
self._event.clear() self._event.clear()
if self._action is ON_EVENT_EXPIRE: if self._action is ON_EVENT_EXPIRE:
...@@ -555,7 +556,7 @@ class CaucaseTest(unittest.TestCase): ...@@ -555,7 +556,7 @@ class CaucaseTest(unittest.TestCase):
""" """
Start caucased server Start caucased server
""" """
self._server_until = until = UntilEvent(self._server_event) self._server_until = until = UntilEvent(self._server_event, None)
self._server = server = threading.Thread( self._server = server = threading.Thread(
target=caucase.http.main, target=caucase.http.main,
kwargs={ kwargs={
......
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