Add descriptive message for timeout
This commit is contained in:
parent
d2906950ce
commit
d5e5433553
|
@ -1065,13 +1065,19 @@ class Testdir(object):
|
||||||
cmdargs, stdout=f1, stderr=f2, close_fds=(sys.platform != "win32")
|
cmdargs, stdout=f1, stderr=f2, close_fds=(sys.platform != "win32")
|
||||||
)
|
)
|
||||||
timeout = kwargs.get("timeout")
|
timeout = kwargs.get("timeout")
|
||||||
|
|
||||||
|
timeout_message = (
|
||||||
|
"{seconds} second timeout expired running:"
|
||||||
|
" {command}".format(seconds=timeout, command=cmdargs)
|
||||||
|
)
|
||||||
|
|
||||||
if timeout is None:
|
if timeout is None:
|
||||||
ret = popen.wait()
|
ret = popen.wait()
|
||||||
elif six.PY3:
|
elif six.PY3:
|
||||||
try:
|
try:
|
||||||
ret = popen.wait(timeout)
|
ret = popen.wait(timeout)
|
||||||
except subprocess.TimeoutExpired:
|
except subprocess.TimeoutExpired:
|
||||||
raise self.TimeoutExpired()
|
raise self.TimeoutExpired(timeout_message)
|
||||||
else:
|
else:
|
||||||
end = time.time() + timeout
|
end = time.time() + timeout
|
||||||
|
|
||||||
|
@ -1082,7 +1088,7 @@ class Testdir(object):
|
||||||
|
|
||||||
remaining = end - time.time()
|
remaining = end - time.time()
|
||||||
if remaining <= 0:
|
if remaining <= 0:
|
||||||
raise self.TimeoutExpired()
|
raise self.TimeoutExpired(timeout_message)
|
||||||
|
|
||||||
time.sleep(remaining * 0.9)
|
time.sleep(remaining * 0.9)
|
||||||
finally:
|
finally:
|
||||||
|
|
Loading…
Reference in New Issue