You've already forked MicroPythonOS
mirror of
https://github.com/m5stack/MicroPythonOS.git
synced 2026-05-20 11:51:27 -07:00
Prevent tests from running twice
This commit is contained in:
@@ -171,7 +171,3 @@ class TestGraphicalAboutApp(unittest.TestCase):
|
||||
print("=== OS version test completed successfully ===")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Note: This file is executed by unittest.sh which handles unittest.main()
|
||||
# But we include it here for completeness
|
||||
unittest.main()
|
||||
|
||||
@@ -214,5 +214,3 @@ class TestAnimationDeletedWidget(unittest.TestCase):
|
||||
print("=== Multiple animations test PASSED ===")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
@@ -316,5 +316,3 @@ class TestGraphicalMposKeyboard(unittest.TestCase):
|
||||
print("=== Comparison test PASSED ===")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
@@ -188,5 +188,3 @@ class TestMposKeyboard(unittest.TestCase):
|
||||
print("API compatibility verified")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
@@ -185,5 +185,3 @@ class TestKeyboardAnimation(unittest.TestCase):
|
||||
print("=== Position methods test PASSED ===")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
@@ -141,5 +141,3 @@ class TestMethodForwarding(unittest.TestCase):
|
||||
print("Method forwarding preserves behavior correctly!")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
@@ -373,7 +373,3 @@ class TestKeyboardStyling(unittest.TestCase):
|
||||
print("=== Pure white test PASSED ===")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Note: This file is executed by unittest.sh which handles unittest.main()
|
||||
# But we include it here for completeness
|
||||
unittest.main()
|
||||
|
||||
@@ -67,5 +67,3 @@ class TestStartApp(unittest.TestCase):
|
||||
print("Launcher restart successful")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
@@ -302,5 +302,3 @@ class TestIntent(unittest.TestCase):
|
||||
self.assertTrue(intent.extras["data"]["config"]["retry"])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
@@ -564,5 +564,3 @@ class TestUpdateDownloader(unittest.TestCase):
|
||||
self.assertEqual(result['bytes_written'], 8192)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
@@ -325,5 +325,3 @@ class TestOSUpdateGraphicalScreenshots(unittest.TestCase):
|
||||
capture_screenshot(screenshot_path)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
@@ -476,5 +476,3 @@ class TestSharedPreferences(unittest.TestCase):
|
||||
self.assertEqual(loaded["settings"]["limits"][2], 30)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
+9
-3
@@ -5,6 +5,7 @@ mydir=$(dirname "$mydir")
|
||||
testdir="$mydir"
|
||||
scriptdir=$(readlink -f "$mydir"/../scripts/)
|
||||
fs="$mydir"/../internal_filesystem/
|
||||
mpremote="$mydir"/../lvgl_micropython/lib/micropython/tools/mpremote/mpremote.py
|
||||
|
||||
# Parse arguments
|
||||
ondevice=""
|
||||
@@ -22,6 +23,11 @@ while [ $# -gt 0 ]; do
|
||||
shift
|
||||
done
|
||||
|
||||
if [ ! -z "$ondevice" ]; then
|
||||
echo "Hack: reset the device to make sure no previous UnitTest classes have been registered..."
|
||||
"$mpremote" reset
|
||||
sleep 15
|
||||
fi
|
||||
|
||||
# print os and set binary
|
||||
os_name=$(uname -s)
|
||||
@@ -80,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.py exec "import sys ; sys.path.append('lib') ; sys.path.append('tests')
|
||||
"$mpremote" exec "import sys ; sys.path.append('lib') ; sys.path.append('tests')
|
||||
$(cat $file)
|
||||
result = unittest.main()
|
||||
if result.wasSuccessful():
|
||||
@@ -90,7 +96,7 @@ else:
|
||||
" | tee "$testlog"
|
||||
else
|
||||
# Regular test: no boot files
|
||||
mpremote.py exec "import sys ; sys.path.append('lib')
|
||||
"$mpremote" exec "import sys ; sys.path.append('lib')
|
||||
$(cat $file)
|
||||
result = unittest.main()
|
||||
if result.wasSuccessful():
|
||||
@@ -99,7 +105,7 @@ else:
|
||||
print('TEST WAS A FAILURE')
|
||||
" | tee "$testlog"
|
||||
fi
|
||||
grep "TEST WAS A SUCCESS" "$testlog"
|
||||
grep -q "TEST WAS A SUCCESS" "$testlog"
|
||||
result=$?
|
||||
fi
|
||||
popd
|
||||
|
||||
Reference in New Issue
Block a user