From 921afa0820ec8d6805ae8f141d4d96c57cde4cc4 Mon Sep 17 00:00:00 2001 From: cladmi Date: Sat, 20 Oct 2018 02:20:33 +0200 Subject: [PATCH] testrunner: fix script when RIOTBASE is not defined If not defined it was raising a KeyError. Use the 'get' function to handle non defined value. It did not put the value in the `default` case as it would have changed the behavior when `RIOTBASE` is defined but empty. --- dist/pythonlibs/testrunner/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dist/pythonlibs/testrunner/__init__.py b/dist/pythonlibs/testrunner/__init__.py index 8678b90b13..9d16cb3df7 100755 --- a/dist/pythonlibs/testrunner/__init__.py +++ b/dist/pythonlibs/testrunner/__init__.py @@ -16,8 +16,9 @@ from traceback import extract_tb, print_tb import pexpect PEXPECT_PATH = os.path.dirname(pexpect.__file__) -RIOTBASE = os.environ['RIOTBASE'] or \ - os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "..")) +RIOTBASE = (os.environ.get('RIOTBASE') or + os.path.abspath(os.path.join(os.path.dirname(__file__), + "..", "..", ".."))) # Setting an empty 'TESTRUNNER_START_DELAY' environment variable use the # default value (3)