Skip to content

Updates tools to be runnable in Python 3 #6592

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tools/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,8 @@ def format_validation_error(self, error, path):
return self.format_validation_error(error.context[0], path)
else:
return "in {} element {}: {}".format(
path, str(".".join(str(p) for p in error.absolute_path)), error.message)
path, ".".join(p for p in error.absolute_path),
error.message.replace('u\'','\''))

def __init__(self, tgt, top_level_dirs=None, app_config=None):
"""Construct a mbed configuration
Expand Down
2 changes: 1 addition & 1 deletion tools/test/config/invalid_key/test_data.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"K64F": {
"exception_msg": "Additional properties are not allowed (u'unknown_key' was unexpected)"
"exception_msg": "Additional properties are not allowed ('unknown_key' was unexpected)"
}
}
2 changes: 1 addition & 1 deletion tools/test/config/invalid_key_lib/test_data.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"K64F": {
"exception_msg": "Additional properties are not allowed (u'unknown_key' was unexpected)"
"exception_msg": "Additional properties are not allowed ('unknown_key' was unexpected)"
}
}
6 changes: 4 additions & 2 deletions tools/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2113,11 +2113,13 @@ def find_tests(base_dir, target_name, toolchain_name, app_config=None):
# Also find any COMMON paths, we'll add these later once we find all the base tests
if 'COMMON' in relative_path_parts:
if relative_path_parts[0] != 'COMMON':
def predicate(base_pred, group_pred, (name, base, group, case)):
def predicate(base_pred, group_pred, name_base_group_case):
(name, base, group, case) = name_base_group_case
return base == base_pred and group == group_pred
commons.append((functools.partial(predicate, walk_base_dir, relative_path_parts[0]), d))
else:
def predicate(base_pred, (name, base, group, case)):
def predicate(base_pred, name_base_group_case):
(name, base, group, case) = name_base_group_case
return base == base_pred
commons.append((functools.partial(predicate, walk_base_dir), d))

Expand Down