From 4519e66326630442c22c4cc6a0a2fc46b212fdbe Mon Sep 17 00:00:00 2001 From: "Daniel R. Kumor" Date: Tue, 27 Aug 2019 21:12:05 -0400 Subject: [PATCH] Increased wait time for test queue... I don't know what is going on, but I don't like it - the timeout in Queue.get() seems to never actually be fired! Also, github tests seem to sorta... fail on the timeouts --- rtcbot/base/thread.py | 5 +++-- tests/test_base.py | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/rtcbot/base/thread.py b/rtcbot/base/thread.py index 92ffbcc..4a101f7 100644 --- a/rtcbot/base/thread.py +++ b/rtcbot/base/thread.py @@ -44,8 +44,9 @@ def _producer(self): while not self._shouldClose: # In real code, there should be a timeout in get to make sure _shouldClose is not True try: - self._put_nowait(self.testQueue.get(1)) - except TimeoutError: + # WTF: why does timeout not work here? + self._put_nowait(self.testQueue.get(timeout=3)) + except queue.Empty: pass self.testResultQueue.put("<>") self._setReady(False) diff --git a/tests/test_base.py b/tests/test_base.py index 11dc96c..8e63169 100644 --- a/tests/test_base.py +++ b/tests/test_base.py @@ -148,13 +148,13 @@ async def test_ThreadedProducer(self): def pushsleep(): # Work around the lack of a timeout in testing p - time.sleep(1) + time.sleep(5) p.testQueue.put("Ending") threading.Thread(target=pushsleep).run() p.close() - await asyncio.sleep(0.01) + await asyncio.sleep(0.1) self.assertEqual(p.ready, False)