Skip to content

Commit 1471d22

Browse files
author
Olli-Pekka Puolitaival
authored
Merge pull request #11243 from OPpuolitaival/py3
Python3 fixes
2 parents 033fffe + ba26bd9 commit 1471d22

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

tools/test/examples/examples_lib.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def print_list(lst):
5858

5959

6060
def print_category(results, index, message):
61-
summary = [example for key, summ in results.items()
61+
summary = [example for key, summ in list(results.items())
6262
for example in summ[index]]
6363
if all(len(s) == 0 for s in summary):
6464
return
@@ -256,7 +256,7 @@ def get_num_failures(results, export=False):
256256
"""
257257
num_failures = 0
258258

259-
for key, val in results.items():
259+
for key, val in list(results.items()):
260260
num_failures = num_failures + len(val[3])
261261
if export:
262262
num_failures += len(val[4])
@@ -384,7 +384,7 @@ def compile_repos(config, toolchains, targets, profile, verbose, examples):
384384
successes = []
385385
compiled = True
386386
pass_status = True
387-
if example.has_key('test') and example['test'] and example.has_key('baud_rate') and example.has_key('compare_log'):
387+
if 'test' in example and example['test'] and 'baud_rate' in example and 'compare_log'in example:
388388
test_example = True
389389
else:
390390
test_example = False
@@ -408,6 +408,7 @@ def compile_repos(config, toolchains, targets, profile, verbose, examples):
408408
proc = subprocess.Popen(build_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
409409

410410
std_out, std_err = proc.communicate()
411+
std_out = std_out.decode('utf-8')
411412
print ("\n#### STDOUT ####\n%s\n#### STDERR ####\n%s\n#### End of STDOUT/STDERR ####\n" % (std_out,std_err))
412413

413414
if test_example:
@@ -427,7 +428,7 @@ def compile_repos(config, toolchains, targets, profile, verbose, examples):
427428
if test_example:
428429
test_group = "{}-{}-{}".format(target, toolchain, example['baud_rate'])
429430
if image:
430-
if not test_json['builds'].has_key(test_group):
431+
if not test_group in test_json['builds']:
431432
test_json['builds'][test_group] = {
432433
"platform":target ,
433434
"toolchain": toolchain ,

0 commit comments

Comments
 (0)