Simplify and fix tests

This commit is contained in:
Thomas Farstrike
2025-11-23 05:46:21 +01:00
parent 09c5249203
commit c3e0a1ceca
13 changed files with 8 additions and 30 deletions
+2 -2
View File
@@ -61,9 +61,9 @@ pushd internal_filesystem/
elif [ ! -z "$script" ]; then # it's an app name
scriptdir="$script"
echo "Running app from $scriptdir"
"$binary" -X heapsize=$HEAPSIZE -v -i -c "import sys ; sys.path.append('lib/') ; import mpos.main ; import mpos.apps; mpos.apps.start_app('$scriptdir')"
"$binary" -X heapsize=$HEAPSIZE -v -i -c "$(cat boot.py) ; import mpos.apps; mpos.apps.start_app('$scriptdir')"
else
"$binary" -X heapsize=$HEAPSIZE -v -i -c "import sys ; sys.path.append('lib/') ; import mpos.main"
"$binary" -X heapsize=$HEAPSIZE -v -i -c "$(cat boot.py)"
fi
-2
View File
@@ -634,5 +634,3 @@ class TestConnectivityManagerIntegration(unittest.TestCase):
self.assertFalse(app3_state[0])
if __name__ == '__main__':
unittest.main()
-2
View File
@@ -103,5 +103,3 @@ class TestAbcButtonDebug(unittest.TestCase):
print("="*70)
if __name__ == "__main__":
unittest.main()
@@ -145,5 +145,3 @@ class TestKeyboardCrash(unittest.TestCase):
print("SUCCESS: Multiple keyboards work")
if __name__ == "__main__":
unittest.main()
@@ -185,5 +185,3 @@ class TestDefaultVsCustomKeyboard(unittest.TestCase):
return labels
if __name__ == "__main__":
unittest.main()
@@ -284,5 +284,3 @@ class TestKeyboardLayoutSwitching(unittest.TestCase):
print("\nSUCCESS: Event handler preserves custom layout!")
if __name__ == "__main__":
unittest.main()
@@ -153,5 +153,3 @@ class TestKeyboardModeSwitch(unittest.TestCase):
print("Note: The handler filters for VALUE_CHANGED events only")
if __name__ == "__main__":
unittest.main()
@@ -225,6 +225,3 @@ class TestKeyboardQButton(unittest.TestCase):
self.assertTrue(len(found_buttons) > 0,
"Should find at least some buttons on keyboard")
if __name__ == "__main__":
unittest.main()
@@ -150,5 +150,3 @@ class TestRapidModeSwitching(unittest.TestCase):
except:
pass
if __name__ == "__main__":
unittest.main()
-2
View File
@@ -246,5 +246,3 @@ class TestLaunchSpecificApps(unittest.TestCase):
f"About app should load without errors: {error_msg}")
if __name__ == '__main__':
unittest.main()
-2
View File
@@ -229,5 +229,3 @@ class TestWiFiKeyboard(unittest.TestCase):
print("This prevents LVGL auto-insertion and fixes double-character bug!")
if __name__ == "__main__":
unittest.main()
-2
View File
@@ -455,5 +455,3 @@ class TestWifiServiceDisconnect(unittest.TestCase):
WifiService.disconnect(network_module=None)
if __name__ == '__main__':
unittest.main()
+6 -5
View File
@@ -60,16 +60,17 @@ one_test() {
# Desktop execution
if [ $is_graphical -eq 1 ]; then
# Graphical test: include boot_unix.py and main.py
"$binary" -X heapsize=8M -c "import sys ; sys.path.append('lib/') ; import mpos.main ; import mpos.apps; sys.path.append(\"$tests_abs_path\")
"$binary" -X heapsize=8M -c "$(cat boot.py) ; import mpos.main ; import mpos.apps; sys.path.append(\"$tests_abs_path\")
$(cat $file)
result = unittest.main() ; sys.exit(0 if result.wasSuccessful() else 1) "
result=$?
else
# Regular test: no boot files
"$binary" -X heapsize=8M -c "import sys ; sys.path.append('lib/')
"$binary" -X heapsize=8M -c "$(cat boot.py)
$(cat $file)
result = unittest.main() ; sys.exit(0 if result.wasSuccessful() else 1) "
result=$?
fi
result=$?
else
if [ ! -z "$ondevice" ]; then
echo "Hack: reset the device to make sure no previous UnitTest classes have been registered..."
@@ -85,7 +86,7 @@ result = unittest.main() ; sys.exit(0 if result.wasSuccessful() else 1) "
echo "$test logging to $testlog"
if [ $is_graphical -eq 1 ]; then
# Graphical test: system already initialized, just add test paths
"$mpremote" exec "import sys ; sys.path.append('lib') ; sys.path.append('tests')
"$mpremote" exec "$(cat boot.py) ; sys.path.append('tests')
$(cat $file)
result = unittest.main()
if result.wasSuccessful():
@@ -95,7 +96,7 @@ else:
" | tee "$testlog"
else
# Regular test: no boot files
"$mpremote" exec "import sys ; sys.path.append('lib')
"$mpremote" exec "$(cat boot.py)
$(cat $file)
result = unittest.main()
if result.wasSuccessful():