From 2ead5ef3a02d903a0b8be51a7794cffd797ad6ce Mon Sep 17 00:00:00 2001 From: Hauke Petersen <hauke.petersen@fu-berlin.de> Date: Thu, 30 Nov 2017 10:02:58 +0100 Subject: [PATCH] tools/testrunner: minor code beautifications --- dist/tools/testrunner/testrunner.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/dist/tools/testrunner/testrunner.py b/dist/tools/testrunner/testrunner.py index 5b01362330..40f0f56520 100755 --- a/dist/tools/testrunner/testrunner.py +++ b/dist/tools/testrunner/testrunner.py @@ -26,9 +26,7 @@ def find_exc_origin(exc_info): pos = list_until(extract_tb(exc_info), lambda frame: frame[0].startswith(PEXPECT_PATH) )[-1] - return pos[3], \ - os.path.relpath(os.path.abspath(pos[0]), RIOTBASE), \ - pos[1] + return (pos[3], os.path.relpath(os.path.abspath(pos[0]), RIOTBASE), pos[1]) def run(testfunc, timeout=10, echo=True, traceback=False): env = os.environ.copy() @@ -49,16 +47,14 @@ def run(testfunc, timeout=10, echo=True, traceback=False): try: testfunc(child) except pexpect.TIMEOUT: - line, filename, lineno = find_exc_origin(sys.exc_info()[2]) - print("Timeout in expect script at \"%s\" (%s:%d)" % - (line, filename, lineno)) + trace = find_exc_origin(sys.exc_info()[2]) + print("Timeout in expect script at \"%s\" (%s:%d)" % trace) if traceback: print_tb(sys.exc_info()[2]) return 1 except pexpect.EOF: - line, filename, lineno = find_exc_origin(sys.exc_info()[2]) - print("Unexpected end of file in expect script at \"%s\" (%s:%d)" % - (line, filename, lineno)) + trace = find_exc_origin(sys.exc_info()[2]) + print("Unexpected end of file in expect script at \"%s\" (%s:%d)" % trace) if traceback: print_tb(sys.exc_info()[2]) return 1 -- GitLab