Skip to content

Commit e6f37d6

Browse files
Fix tests/test_graphical_launch_all_apps.py
It didn't detect failing apps.
1 parent 547e100 commit e6f37d6

File tree

1 file changed

+28
-21
lines changed

1 file changed

+28
-21
lines changed

tests/test_graphical_launch_all_apps.py

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -117,28 +117,35 @@ def test_launch_all_apps(self):
117117
print(f" Error: {fail['error']}")
118118
print()
119119

120-
# Test should detect at least one error (the intentional errortest app)
121-
if len(failed_apps) > 0:
122-
print(f"✓ Test successfully detected {len(failed_apps)} app(s) with errors")
123-
124-
# Check if we found the errortest app
125-
errortest_found = any(
126-
'errortest' in fail['info']['package_name'].lower()
127-
for fail in failed_apps
128-
)
129-
130-
if errortest_found:
131-
print("✓ Successfully detected the intentional error in errortest app")
132-
133-
# Verify errortest was found
134-
all_app_names = [app['package_name'] for app in self.apps_to_test]
135-
has_errortest = any('errortest' in name.lower() for name in all_app_names)
136-
137-
if has_errortest:
138-
self.assertTrue(errortest_found,
139-
"Failed to detect error in com.micropythonos.errortest app")
120+
# Separate errortest failures from other failures
121+
errortest_failures = [
122+
fail for fail in failed_apps
123+
if 'errortest' in fail['info']['package_name'].lower()
124+
]
125+
other_failures = [
126+
fail for fail in failed_apps
127+
if 'errortest' not in fail['info']['package_name'].lower()
128+
]
129+
130+
# Check if errortest app exists
131+
all_app_names = [app['package_name'] for app in self.apps_to_test]
132+
has_errortest = any('errortest' in name.lower() for name in all_app_names)
133+
134+
# Verify errortest app fails if it exists
135+
if has_errortest:
136+
self.assertTrue(len(errortest_failures) > 0,
137+
"Failed to detect error in com.micropythonos.errortest app")
138+
print("✓ Successfully detected the intentional error in errortest app")
139+
140+
# Fail the test if any non-errortest apps have errors
141+
if other_failures:
142+
print(f"\n❌ FAIL: {len(other_failures)} non-errortest app(s) have errors:")
143+
for fail in other_failures:
144+
print(f" - {fail['info']['label']} ({fail['info']['package_name']})")
145+
print(f" Error: {fail['error']}")
146+
self.fail(f"{len(other_failures)} app(s) failed to launch (excluding errortest)")
140147
else:
141-
print("⚠ Warning: No errors detected. All apps launched successfully.")
148+
print("All non-errortest apps launched successfully")
142149

143150

144151
class TestLaunchSpecificApps(unittest.TestCase):

0 commit comments

Comments
 (0)