From 6eab575dc563911cf85e3ac7da2ce6265701384b Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 26 Sep 2026 10:35:50 +0100 Subject: [PATCH] Check the blank component list before discovery The guard validates arguments, so it reads better next to the other early exit than after the loop that already skips blank patterns. --- script/test_build_components.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/script/test_build_components.py b/script/test_build_components.py index de93968d4c7..d3dfd360763 100755 --- a/script/test_build_components.py +++ b/script/test_build_components.py @@ -1062,6 +1062,12 @@ def test_components( # toolchain build. include_validate = esphome_command != "compile" + # A blank pattern list would slide into the reference-baseline + # fallback and exit green while building nothing + if fail_on_no_tests and not any(component_patterns): + print("No components requested (blank component list)") + return 1 + # Find all component tests; remember which components each pattern # (wildcards included) matched, for the deferred no-tests accounting all_tests = {} @@ -1076,12 +1082,6 @@ def test_components( pattern_components[pattern] = set(found) all_tests.update(found) - # A blank pattern list would slide into the reference-baseline - # fallback and exit green while building nothing - if fail_on_no_tests and not any(component_patterns): - print("No components requested (blank component list)") - return 1 - if fail_on_no_tests and not all_tests: # Nothing matched: fail before the synthetic baseline spends a # compile reporting success on nothing