diff --git a/scripts/run_desktop.sh b/scripts/run_desktop.sh index 9b6bea4a..5afd373f 100755 --- a/scripts/run_desktop.sh +++ b/scripts/run_desktop.sh @@ -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 diff --git a/tests/test_connectivity_manager.py b/tests/test_connectivity_manager.py index edb854db..99ffd720 100644 --- a/tests/test_connectivity_manager.py +++ b/tests/test_connectivity_manager.py @@ -634,5 +634,3 @@ class TestConnectivityManagerIntegration(unittest.TestCase): self.assertFalse(app3_state[0]) -if __name__ == '__main__': - unittest.main() diff --git a/tests/test_graphical_abc_button_debug.py b/tests/test_graphical_abc_button_debug.py index a3d8a6d2..dc8575da 100644 --- a/tests/test_graphical_abc_button_debug.py +++ b/tests/test_graphical_abc_button_debug.py @@ -103,5 +103,3 @@ class TestAbcButtonDebug(unittest.TestCase): print("="*70) -if __name__ == "__main__": - unittest.main() diff --git a/tests/test_graphical_keyboard_crash_reproduction.py b/tests/test_graphical_keyboard_crash_reproduction.py index 35e5a280..0710735f 100644 --- a/tests/test_graphical_keyboard_crash_reproduction.py +++ b/tests/test_graphical_keyboard_crash_reproduction.py @@ -145,5 +145,3 @@ class TestKeyboardCrash(unittest.TestCase): print("SUCCESS: Multiple keyboards work") -if __name__ == "__main__": - unittest.main() diff --git a/tests/test_graphical_keyboard_default_vs_custom.py b/tests/test_graphical_keyboard_default_vs_custom.py index 85014dbc..5fba3b9b 100644 --- a/tests/test_graphical_keyboard_default_vs_custom.py +++ b/tests/test_graphical_keyboard_default_vs_custom.py @@ -185,5 +185,3 @@ class TestDefaultVsCustomKeyboard(unittest.TestCase): return labels -if __name__ == "__main__": - unittest.main() diff --git a/tests/test_graphical_keyboard_layout_switching.py b/tests/test_graphical_keyboard_layout_switching.py index 7be84607..83c2bcec 100644 --- a/tests/test_graphical_keyboard_layout_switching.py +++ b/tests/test_graphical_keyboard_layout_switching.py @@ -284,5 +284,3 @@ class TestKeyboardLayoutSwitching(unittest.TestCase): print("\nSUCCESS: Event handler preserves custom layout!") -if __name__ == "__main__": - unittest.main() diff --git a/tests/test_graphical_keyboard_mode_switch.py b/tests/test_graphical_keyboard_mode_switch.py index 713f97b7..85967d1d 100644 --- a/tests/test_graphical_keyboard_mode_switch.py +++ b/tests/test_graphical_keyboard_mode_switch.py @@ -153,5 +153,3 @@ class TestKeyboardModeSwitch(unittest.TestCase): print("Note: The handler filters for VALUE_CHANGED events only") -if __name__ == "__main__": - unittest.main() diff --git a/tests/test_graphical_keyboard_q_button_bug.py b/tests/test_graphical_keyboard_q_button_bug.py index 1d7f996d..65555ab6 100644 --- a/tests/test_graphical_keyboard_q_button_bug.py +++ b/tests/test_graphical_keyboard_q_button_bug.py @@ -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() diff --git a/tests/test_graphical_keyboard_rapid_mode_switch.py b/tests/test_graphical_keyboard_rapid_mode_switch.py index cf718a97..7cded668 100644 --- a/tests/test_graphical_keyboard_rapid_mode_switch.py +++ b/tests/test_graphical_keyboard_rapid_mode_switch.py @@ -150,5 +150,3 @@ class TestRapidModeSwitching(unittest.TestCase): except: pass -if __name__ == "__main__": - unittest.main() diff --git a/tests/test_graphical_launch_all_apps.py b/tests/test_graphical_launch_all_apps.py index 54da282c..6dcae3bb 100644 --- a/tests/test_graphical_launch_all_apps.py +++ b/tests/test_graphical_launch_all_apps.py @@ -246,5 +246,3 @@ class TestLaunchSpecificApps(unittest.TestCase): f"About app should load without errors: {error_msg}") -if __name__ == '__main__': - unittest.main() diff --git a/tests/test_graphical_wifi_keyboard.py b/tests/test_graphical_wifi_keyboard.py index b22a2548..59fd910a 100644 --- a/tests/test_graphical_wifi_keyboard.py +++ b/tests/test_graphical_wifi_keyboard.py @@ -229,5 +229,3 @@ class TestWiFiKeyboard(unittest.TestCase): print("This prevents LVGL auto-insertion and fixes double-character bug!") -if __name__ == "__main__": - unittest.main() diff --git a/tests/test_wifi_service.py b/tests/test_wifi_service.py index 1d2794c8..6583b4a7 100644 --- a/tests/test_wifi_service.py +++ b/tests/test_wifi_service.py @@ -455,5 +455,3 @@ class TestWifiServiceDisconnect(unittest.TestCase): WifiService.disconnect(network_module=None) -if __name__ == '__main__': - unittest.main() diff --git a/tests/unittest.sh b/tests/unittest.sh index 15539a97..ad32a9d6 100755 --- a/tests/unittest.sh +++ b/tests/unittest.sh @@ -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():