mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Unittest - Try to avoid racing conditions failures when capturing stdout/stderr
* The new unblocking strategy for subprocesses involves timeouts and waiting periods. If the timeout is too short (or absent) tests may show intermittent failure. * Increasing the timeout may make tests a bit slower but more reliable.
This commit is contained in:
parent
9b6b1cf5f8
commit
1f279ffde8
1 changed files with 6 additions and 2 deletions
|
@ -62,12 +62,16 @@ def _get_output(proc, input):
|
|||
proc.send_signal(signal.SIGABRT)
|
||||
exit = wait_process(proc)
|
||||
|
||||
# NOTE Increase this value if tests fail with None being received as
|
||||
# stdout/stderr instead of the expected content
|
||||
timeout = 0.1 # seconds
|
||||
|
||||
try:
|
||||
out = outq.get_nowait()
|
||||
out = outq.get(timeout=timeout)
|
||||
except Empty:
|
||||
out = None
|
||||
try:
|
||||
err = errq.get_nowait()
|
||||
err = errq.get(timeout=timeout)
|
||||
except Empty:
|
||||
err = None
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue