Skip to content

Commit f89dc92

Browse files
Merge pull request #743 from screamerbg/f/unittest
Remove the requirement to have target and toolchain specified with `mbed test --unittest`
2 parents bb171e8 + 0946274 commit f89dc92

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

mbed/mbed.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2658,17 +2658,10 @@ def test_(toolchain=None, target=None, compile_list=False, run_list=False,
26582658
# Save original working directory
26592659
orig_path = getcwd()
26602660

2661-
target = program.get_target(target)
2662-
tchain = program.get_toolchain(toolchain)
26632661
macros = program.get_macros()
26642662
tools_dir = program.get_tools()
26652663
build_and_run_tests = not compile_list and not run_list and not compile_only and not run_only
26662664

2667-
icetea_command_base = [python_cmd, '-u', os.path.join(tools_dir, 'run_icetea.py')] \
2668-
+ (['-m', target, '-t', tchain]) \
2669-
+ (['-n', tests_by_name] if tests_by_name else []) \
2670-
+ (['-v'] if verbose else [])
2671-
26722665
# Prepare environment variables
26732666
env = program.get_env()
26742667

@@ -2704,6 +2697,14 @@ def test_(toolchain=None, target=None, compile_list=False, run_list=False,
27042697
else:
27052698
warning("Unit testing is not supported with this Mbed OS version.")
27062699
else:
2700+
target = program.get_target(target)
2701+
tchain = program.get_toolchain(toolchain)
2702+
2703+
icetea_command_base = [python_cmd, '-u', os.path.join(tools_dir, 'run_icetea.py')] \
2704+
+ (['-m', target, '-t', tchain]) \
2705+
+ (['-n', tests_by_name] if tests_by_name else []) \
2706+
+ (['-v'] if verbose else [])
2707+
27072708
# Setup the source path if not specified
27082709
if not source or len(source) == 0:
27092710
source = [os.path.relpath(program.path, orig_path)]

0 commit comments

Comments
 (0)