You've already forked MicroPythonOS
mirror of
https://github.com/m5stack/MicroPythonOS.git
synced 2026-05-20 11:51:27 -07:00
Simplify and fix tests
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -634,5 +634,3 @@ class TestConnectivityManagerIntegration(unittest.TestCase):
|
||||
self.assertFalse(app3_state[0])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -246,5 +246,3 @@ class TestLaunchSpecificApps(unittest.TestCase):
|
||||
f"About app should load without errors: {error_msg}")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
@@ -229,5 +229,3 @@ class TestWiFiKeyboard(unittest.TestCase):
|
||||
print("This prevents LVGL auto-insertion and fixes double-character bug!")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
@@ -455,5 +455,3 @@ class TestWifiServiceDisconnect(unittest.TestCase):
|
||||
WifiService.disconnect(network_module=None)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
+6
-5
@@ -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():
|
||||
|
||||
Reference in New Issue
Block a user