summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2022-04-05 20:47:00 (GMT)
committerGitHub <noreply@github.com>2022-04-05 20:47:00 (GMT)
commita3602d5c9d9fea87c3335aa714c34b35bf698dd0 (patch)
tree95d11da9cdf402136b10447c88e622ed7a2c1222
parent4b8a75d285cad857f491d4aca45a9eeab077a62f (diff)
parentf0f5657f3214bf50f56cf076c9ecbe37c1fd0d75 (diff)
downloadSCons-a3602d5c9d9fea87c3335aa714c34b35bf698dd0.zip
SCons-a3602d5c9d9fea87c3335aa714c34b35bf698dd0.tar.gz
SCons-a3602d5c9d9fea87c3335aa714c34b35bf698dd0.tar.bz2
Merge pull request #4129 from mwichmann/testfw/timeout-exception
test framework: fix exception on timeout
-rwxr-xr-xCHANGES.txt1
-rw-r--r--testing/framework/TestCmd.py14
2 files changed, 10 insertions, 5 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index c1fa7d2..8390f00 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -73,6 +73,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
- Renamed ParseFlag's internal data structure to "mapping" instead of
"dict" (avoid redefining builtin)
- Fix an old use-before-set bug in tex tool (issue #2888)
+ - Fix a test harness exception returning stderr if a wait_for timed out.
From Zhichang Yu:
- Added MSVC_USE_SCRIPT_ARGS variable to pass arguments to MSVC_USE_SCRIPT.
diff --git a/testing/framework/TestCmd.py b/testing/framework/TestCmd.py
index 79b16f5..5759121 100644
--- a/testing/framework/TestCmd.py
+++ b/testing/framework/TestCmd.py
@@ -311,6 +311,7 @@ import time
import traceback
from collections import UserList, UserString
from subprocess import PIPE, STDOUT
+from typing import Optional
IS_WINDOWS = sys.platform == 'win32'
IS_MACOS = sys.platform == 'darwin'
@@ -1641,7 +1642,7 @@ class TestCmd:
"""
time.sleep(seconds)
- def stderr(self, run=None):
+ def stderr(self, run=None) -> Optional[str]:
"""Returns the error output from the specified run number.
If there is no specified run number, then returns the error
@@ -1653,10 +1654,13 @@ class TestCmd:
run = len(self._stderr)
elif run < 0:
run = len(self._stderr) + run
- run = run - 1
- return self._stderr[run]
+ run -= 1
+ try:
+ return self._stderr[run]
+ except IndexError:
+ return None
- def stdout(self, run=None):
+ def stdout(self, run=None) -> Optional[str]:
"""Returns the stored standard output from a given run.
Args:
@@ -1673,7 +1677,7 @@ class TestCmd:
run = len(self._stdout)
elif run < 0:
run = len(self._stdout) + run
- run = run - 1
+ run -= 1
try:
return self._stdout[run]
except IndexError: