diff --git a/.travis.yml b/.travis.yml index 7ecfcd570cd..6c2caa9a6c4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -152,13 +152,18 @@ matrix: # Report success since we have overridden default behavior - bash -c "$STATUS" success "Local $NAME testing has passed" -# - <<: *tools-pytest -# env: NAME=tools-py3.5 -# python: 3.5 -# -# - <<: *tools-pytest -# env: NAME=tools-py3.6 -# python: 3.6 + - <<: *tools-pytest + env: NAME=tools-py3.5 + python: 3.5 + + - <<: *tools-pytest + env: NAME=tools-py3.6 + python: 3.6 + + - <<: *tools-pytest + env: NAME=tools-py3.7 + python: 3.7 + dist: xenial - env: - NAME=astyle diff --git a/tools/config/__init__.py b/tools/config/__init__.py index 747692eb359..f8027c3529a 100644 --- a/tools/config/__init__.py +++ b/tools/config/__init__.py @@ -1204,7 +1204,7 @@ def validate_config(self): min = int(str(min), 0) if min is not None else None max = int(str(max), 0) if max is not None else None - if (value < min or (value > max if max is not None else False)): + if (min is not None and value < min) or (max is not None and value > max): err_msg += "\nInvalid config range for %s, is not in the required range: [%s:%s]"\ % (param, min if min is not None else "-inf", diff --git a/tools/test/build_api/build_api_test.py b/tools/test/build_api/build_api_test.py index a50118bea5c..2fcfc947b8c 100644 --- a/tools/test/build_api/build_api_test.py +++ b/tools/test/build_api/build_api_test.py @@ -141,6 +141,7 @@ def test_build_project_app_config(self, mock_prepare_toolchain, mock_exists, _, lib_config_data=None, ) mock_prepare_toolchain().config.deliver_into.return_value = (None, None) + mock_prepare_toolchain().config.name = None build_project(self.src_paths, self.build_path, self.target, self.toolchain_name, app_config=app_config, notify=notify) @@ -175,6 +176,7 @@ def test_build_project_no_app_config(self, mock_prepare_toolchain, mock_exists, lib_config_data=None, ) mock_prepare_toolchain().config.deliver_into.return_value = (None, None) + mock_prepare_toolchain().config.name = None build_project(self.src_paths, self.build_path, self.target, self.toolchain_name, notify=notify) diff --git a/tools/test/pylint.py b/tools/test/pylint.py index cae95ca02bd..9fc43ae18bf 100644 --- a/tools/test/pylint.py +++ b/tools/test/pylint.py @@ -26,7 +26,8 @@ def execute_pylint(filename): process = subprocess.Popen( ["pylint", filename], stdout=subprocess.PIPE, - stderr=subprocess.PIPE + stderr=subprocess.PIPE, + universal_newlines=True ) stout, sterr = process.communicate() status = process.poll() diff --git a/tools/test/spm/test_generate_partition_code.py b/tools/test/spm/test_generate_partition_code.py index 7726e3a84f1..13abd5e2956 100644 --- a/tools/test/spm/test_generate_partition_code.py +++ b/tools/test/spm/test_generate_partition_code.py @@ -23,7 +23,7 @@ import pytest from jinja2.defaults import DEFAULT_FILTERS -from test_data import * +from .test_data import * from tools.spm.generate_partition_code import * # Imported again as a module for monkey-patching diff --git a/tools/toolchains/arm.py b/tools/toolchains/arm.py index 09f76a8fa49..b609784e74a 100644 --- a/tools/toolchains/arm.py +++ b/tools/toolchains/arm.py @@ -102,7 +102,7 @@ def version_check(self): stdout, _, retcode = run_cmd([self.cc[0], "--vsn"], redirect=True) msg = None min_ver, max_ver = self.ARMCC_RANGE - match = self.ARMCC_VERSION_RE.search(stdout) + match = self.ARMCC_VERSION_RE.search(stdout.encode("utf-8")) found_version = LooseVersion(match.group(1).decode("utf-8")) if match else None min_ver, max_ver = self.ARMCC_RANGE if found_version and (found_version < min_ver or found_version >= max_ver): diff --git a/tools/toolchains/gcc.py b/tools/toolchains/gcc.py index af3c5ca6aa3..d2fd8cb2583 100644 --- a/tools/toolchains/gcc.py +++ b/tools/toolchains/gcc.py @@ -133,7 +133,7 @@ def __init__(self, target, notify=None, macros=None, build_profile=None, def version_check(self): stdout, _, retcode = run_cmd([self.cc[0], "--version"], redirect=True) msg = None - match = self.GCC_VERSION_RE.search(stdout) + match = self.GCC_VERSION_RE.search(stdout.encode("utf-8")) found_version = LooseVersion(match.group(0).decode('utf-8')) if match else None min_ver, max_ver = self.GCC_RANGE if found_version and (found_version < min_ver or found_version >= max_ver): diff --git a/tools/toolchains/iar.py b/tools/toolchains/iar.py index c94d5f089d4..37c085295b2 100644 --- a/tools/toolchains/iar.py +++ b/tools/toolchains/iar.py @@ -99,7 +99,7 @@ def __init__(self, target, notify=None, macros=None, build_profile=None, def version_check(self): stdout, _, retcode = run_cmd([self.cc[0], "--version"], redirect=True) msg = None - match = self.IAR_VERSION_RE.search(stdout) + match = self.IAR_VERSION_RE.search(stdout.encode("utf-8")) found_version = match.group(1).decode("utf-8") if match else None if found_version and LooseVersion(found_version) != self.IAR_VERSION: msg = "Compiler version mismatch: Have {}; expected {}".format( diff --git a/tools/utils.py b/tools/utils.py index fb8869c29cc..ad5db06fdf4 100644 --- a/tools/utils.py +++ b/tools/utils.py @@ -104,7 +104,8 @@ def run_cmd(command, work_dir=None, chroot=None, redirect=False): try: process = Popen(command, stdout=PIPE, - stderr=STDOUT if redirect else PIPE, cwd=work_dir) + stderr=STDOUT if redirect else PIPE, cwd=work_dir, + universal_newlines=True) _stdout, _stderr = process.communicate() except OSError: print("[OS ERROR] Command: "+(' '.join(command)))