Skip to content

Commit 93f0a09

Browse files
authored
Merge pull request #9521 from cmonr/py3-tests-and-fixes
Py3 fixes and Travis CI enablement
2 parents 88d7ef1 + b836b34 commit 93f0a09

File tree

9 files changed

+23
-14
lines changed

9 files changed

+23
-14
lines changed

.travis.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,18 @@ matrix:
152152
# Report success since we have overridden default behavior
153153
- bash -c "$STATUS" success "Local $NAME testing has passed"
154154

155-
# - <<: *tools-pytest
156-
# env: NAME=tools-py3.5
157-
# python: 3.5
158-
#
159-
# - <<: *tools-pytest
160-
# env: NAME=tools-py3.6
161-
# python: 3.6
155+
- <<: *tools-pytest
156+
env: NAME=tools-py3.5
157+
python: 3.5
158+
159+
- <<: *tools-pytest
160+
env: NAME=tools-py3.6
161+
python: 3.6
162+
163+
- <<: *tools-pytest
164+
env: NAME=tools-py3.7
165+
python: 3.7
166+
dist: xenial
162167

163168
- env:
164169
- NAME=astyle

tools/config/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1204,7 +1204,7 @@ def validate_config(self):
12041204
min = int(str(min), 0) if min is not None else None
12051205
max = int(str(max), 0) if max is not None else None
12061206

1207-
if (value < min or (value > max if max is not None else False)):
1207+
if (min is not None and value < min) or (max is not None and value > max):
12081208
err_msg += "\nInvalid config range for %s, is not in the required range: [%s:%s]"\
12091209
% (param,
12101210
min if min is not None else "-inf",

tools/test/build_api/build_api_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ def test_build_project_app_config(self, mock_prepare_toolchain, mock_exists, _,
141141
lib_config_data=None,
142142
)
143143
mock_prepare_toolchain().config.deliver_into.return_value = (None, None)
144+
mock_prepare_toolchain().config.name = None
144145

145146
build_project(self.src_paths, self.build_path, self.target,
146147
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,
175176
lib_config_data=None,
176177
)
177178
mock_prepare_toolchain().config.deliver_into.return_value = (None, None)
179+
mock_prepare_toolchain().config.name = None
178180

179181
build_project(self.src_paths, self.build_path, self.target,
180182
self.toolchain_name, notify=notify)

tools/test/pylint.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ def execute_pylint(filename):
2626
process = subprocess.Popen(
2727
["pylint", filename],
2828
stdout=subprocess.PIPE,
29-
stderr=subprocess.PIPE
29+
stderr=subprocess.PIPE,
30+
universal_newlines=True
3031
)
3132
stout, sterr = process.communicate()
3233
status = process.poll()

tools/test/spm/test_generate_partition_code.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import pytest
2424
from jinja2.defaults import DEFAULT_FILTERS
2525

26-
from test_data import *
26+
from .test_data import *
2727
from tools.spm.generate_partition_code import *
2828

2929
# Imported again as a module for monkey-patching

tools/toolchains/arm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def version_check(self):
102102
stdout, _, retcode = run_cmd([self.cc[0], "--vsn"], redirect=True)
103103
msg = None
104104
min_ver, max_ver = self.ARMCC_RANGE
105-
match = self.ARMCC_VERSION_RE.search(stdout)
105+
match = self.ARMCC_VERSION_RE.search(stdout.encode("utf-8"))
106106
found_version = LooseVersion(match.group(1).decode("utf-8")) if match else None
107107
min_ver, max_ver = self.ARMCC_RANGE
108108
if found_version and (found_version < min_ver or found_version >= max_ver):

tools/toolchains/gcc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def __init__(self, target, notify=None, macros=None, build_profile=None,
133133
def version_check(self):
134134
stdout, _, retcode = run_cmd([self.cc[0], "--version"], redirect=True)
135135
msg = None
136-
match = self.GCC_VERSION_RE.search(stdout)
136+
match = self.GCC_VERSION_RE.search(stdout.encode("utf-8"))
137137
found_version = LooseVersion(match.group(0).decode('utf-8')) if match else None
138138
min_ver, max_ver = self.GCC_RANGE
139139
if found_version and (found_version < min_ver or found_version >= max_ver):

tools/toolchains/iar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def __init__(self, target, notify=None, macros=None, build_profile=None,
9999
def version_check(self):
100100
stdout, _, retcode = run_cmd([self.cc[0], "--version"], redirect=True)
101101
msg = None
102-
match = self.IAR_VERSION_RE.search(stdout)
102+
match = self.IAR_VERSION_RE.search(stdout.encode("utf-8"))
103103
found_version = match.group(1).decode("utf-8") if match else None
104104
if found_version and LooseVersion(found_version) != self.IAR_VERSION:
105105
msg = "Compiler version mismatch: Have {}; expected {}".format(

tools/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ def run_cmd(command, work_dir=None, chroot=None, redirect=False):
104104

105105
try:
106106
process = Popen(command, stdout=PIPE,
107-
stderr=STDOUT if redirect else PIPE, cwd=work_dir)
107+
stderr=STDOUT if redirect else PIPE, cwd=work_dir,
108+
universal_newlines=True)
108109
_stdout, _stderr = process.communicate()
109110
except OSError:
110111
print("[OS ERROR] Command: "+(' '.join(command)))

0 commit comments

Comments
 (0)