Skip to content

Commit e5f1fca

Browse files
committed
fix: add disabled apps to junit with --include-all-apps flag
1 parent b8463f4 commit e5f1fca

File tree

4 files changed

+27
-7
lines changed

4 files changed

+27
-7
lines changed

idf_build_apps/app.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,9 @@ def build(
511511
BuildStatus.UNKNOWN,
512512
BuildStatus.SHOULD_BE_BUILT,
513513
):
514-
self.build_comment = f'Build {self.build_status.value}. Skipping...'
514+
if not self.build_comment:
515+
self.build_comment = f'Build {self.build_status.value}. Skipping...'
516+
515517
return
516518

517519
# real build starts here

idf_build_apps/main.py

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
BuildArguments,
2323
DumpManifestShaArguments,
2424
FindArguments,
25+
FindBuildArguments,
2526
add_args_to_parser,
2627
apply_config_file,
2728
)
@@ -386,23 +387,32 @@ def main():
386387
sys.exit(0)
387388

388389
kwargs = vars(args)
390+
kwargs_without_none = drop_none_kwargs(kwargs)
389391
action = kwargs.pop('action')
390392
config_file = kwargs.pop('config_file')
391393
if config_file:
392394
apply_config_file(config_file)
393395

394396
if action == 'dump-manifest-sha':
395-
arguments = DumpManifestShaArguments(**drop_none_kwargs(kwargs))
397+
arguments = DumpManifestShaArguments(**kwargs_without_none)
396398
Manifest.from_files(arguments.manifest_files).dump_sha_values(arguments.output)
397399
sys.exit(0)
398-
elif action == 'find':
399-
arguments = FindArguments(**drop_none_kwargs(kwargs))
400+
401+
if action == 'find':
402+
arguments = FindArguments(**kwargs_without_none)
403+
find_arguments = arguments
400404
else:
401-
arguments = BuildArguments(**drop_none_kwargs(kwargs))
405+
arguments = BuildArguments(**kwargs_without_none)
406+
407+
# Because build needs to find apps, we need to create find_arguments here
408+
find_arguments = FindArguments(
409+
**{k: v for k, v in kwargs_without_none.items() if k in FindBuildArguments.model_fields}
410+
)
402411

403412
# real call starts here
404413
# build also needs to find first
405-
apps = find_apps(args.paths, args.target, find_arguments=arguments)
414+
apps = find_apps(args.paths, args.target, find_arguments=find_arguments)
415+
406416
if isinstance(arguments, FindArguments): # find only
407417
if arguments.output:
408418
os.makedirs(os.path.dirname(os.path.realpath(arguments.output)), exist_ok=True)
@@ -444,6 +454,12 @@ def main():
444454
for app in failed_apps:
445455
print(f' {app}')
446456

457+
disabled_apps = [app for app in apps if app.build_status == BuildStatus.DISABLED]
458+
if disabled_apps:
459+
print('Disabled the following apps:')
460+
for app in disabled_apps:
461+
print(f' {app}')
462+
447463
if ret_code != 0:
448464
sys.exit(ret_code)
449465

tests/test_build.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ def test_build_with_junit_output(self, tmp_path):
129129
with open('test.xml') as f:
130130
xml = ElementTree.fromstring(f.read())
131131

132+
print(ElementTree.tostring(xml, encoding='utf8').decode('utf8'))
133+
132134
test_suite = xml.findall('testsuite')[0]
133135
assert test_suite.attrib['tests'] == '0'
134136
assert test_suite.attrib['failures'] == '0'

tests/test_finder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def test_include_disabled_apps(self, tmp_path):
138138
for app in apps:
139139
assert app.build_status == BuildStatus.DISABLED
140140
app.build()
141-
assert app.build_comment == 'Build disabled. Skipping...'
141+
assert app.build_comment.startswith('Not enabled by manifest rules:')
142142

143143

144144
class TestFindWithModifiedFilesComponents:

0 commit comments

Comments
 (0)