From d30bd7ae47a8264b37455dd14bc595d957955203 Mon Sep 17 00:00:00 2001 From: sanjuprakashk Date: Tue, 16 Jul 2019 09:28:46 -0700 Subject: [PATCH] dist/pythinlibs/testrunner: dynamic changing of test timeout Few flashers require a longer time to flash code and reset the device and requires the test script to wait for a longer time before timing out. This commit adds a environment variable "RIOT_TEST_TIMEOUT" that can be set by the user to vary the timeout in accordance to the requirements of the system on-behalf-of: @sparkmeter --- dist/pythonlibs/testrunner/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dist/pythonlibs/testrunner/__init__.py b/dist/pythonlibs/testrunner/__init__.py index 9ff2d9de3..3a372e513 100755 --- a/dist/pythonlibs/testrunner/__init__.py +++ b/dist/pythonlibs/testrunner/__init__.py @@ -15,8 +15,13 @@ import pexpect from .spawn import find_exc_origin, setup_child, teardown_child from .unittest import PexpectTestCase # noqa, F401 expose to users +# Timeout for tests can be changed by setting RIOT_TEST_TIMEOUT to the desired +# value in the environment variables +# default value (10) +TIMEOUT = int(os.environ.get('RIOT_TEST_TIMEOUT') or 10) -def run(testfunc, timeout=10, echo=True, traceback=False): + +def run(testfunc, timeout=TIMEOUT, echo=True, traceback=False): child = setup_child(timeout, env=os.environ, logfile=sys.stdout if echo else None) try: