Skip to content

Commit 36a577e

Browse files
author
Bogdan Marinescu
committed
Make build_tests work with target names, not just Target instances
With this change, custom targets defined by the application being tested in its mbed_app.json file can be used with tests. Note that `build_project` already accepts both target names and instances, so the call to `build_project` inside `build_tests` will still work.
1 parent e3d29fe commit 36a577e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tools/test_api.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2030,9 +2030,11 @@ def build_tests(tests, base_source_paths, build_path, target, toolchain_name,
20302030
execution_directory = "."
20312031

20322032
base_path = norm_relative_path(build_path, execution_directory)
2033+
2034+
target_name = target if isinstance(target, str) else target.name
20332035

20342036
test_build = {
2035-
"platform": target.name,
2037+
"platform": target_name,
20362038
"toolchain": toolchain_name,
20372039
"base_path": base_path,
20382040
"baud_rate": 9600,
@@ -2086,7 +2088,7 @@ def build_tests(tests, base_source_paths, build_path, target, toolchain_name,
20862088
print 'Image: %s'% bin_file
20872089

20882090
test_builds = {}
2089-
test_builds["%s-%s" % (target.name, toolchain_name)] = test_build
2091+
test_builds["%s-%s" % (target_name, toolchain_name)] = test_build
20902092

20912093

20922094
return result, test_builds

0 commit comments

Comments
 (0)