Skip to content

Commit aea7244

Browse files
Change ondevice positional to --ondevice
1 parent f8e0eb5 commit aea7244

8 files changed

+29
-14
lines changed

CLAUDE.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,13 +178,16 @@ Tests are in the `tests/` directory. There are two types: unit tests and manual
178178
./tests/unittest.sh tests/test_start_app.py
179179

180180
# Run a specific test on connected device (via mpremote)
181-
./tests/unittest.sh tests/test_shared_preferences.py ondevice
181+
./tests/unittest.sh tests/test_shared_preferences.py --ondevice
182+
183+
# Run all tests on connected device
184+
./tests/unittest.sh --ondevice
182185
```
183186

184187
The `unittest.sh` script:
185188
- Automatically detects the platform (Linux/macOS) and uses the correct binary
186189
- Sets up the proper paths and heapsize
187-
- Can run tests on device using `mpremote` with the `ondevice` argument
190+
- Can run tests on device using `mpremote` with the `--ondevice` flag
188191
- Runs all `test_*.py` files when no argument is provided
189192
- On device, assumes the OS is already running (boot.py and main.py already executed), so tests run against the live system
190193
- Test infrastructure (graphical_test_helper.py) is automatically installed by `scripts/install.sh`
@@ -202,7 +205,7 @@ The `unittest.sh` script:
202205
./tests/unittest.sh tests/test_graphical_about_app.py
203206

204207
# Run graphical tests on device
205-
./tests/unittest.sh tests/test_graphical_about_app.py ondevice
208+
./tests/unittest.sh tests/test_graphical_about_app.py --ondevice
206209

207210
# Convert screenshots from raw RGB565 to PNG
208211
cd tests/screenshots

tests/test_graphical_about_app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
1313
Usage:
1414
Desktop: ./tests/unittest.sh tests/test_graphical_about_app.py
15-
Device: ./tests/unittest.sh tests/test_graphical_about_app.py ondevice
15+
Device: ./tests/unittest.sh tests/test_graphical_about_app.py --ondevice
1616
"""
1717

1818
import unittest

tests/test_graphical_animation_deleted_widget.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
1313
Usage:
1414
Desktop: ./tests/unittest.sh tests/test_graphical_animation_deleted_widget.py
15-
Device: ./tests/unittest.sh tests/test_graphical_animation_deleted_widget.py ondevice
15+
Device: ./tests/unittest.sh tests/test_graphical_animation_deleted_widget.py --ondevice
1616
"""
1717

1818
import unittest

tests/test_graphical_custom_keyboard.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
77
Usage:
88
Desktop: ./tests/unittest.sh tests/test_graphical_custom_keyboard.py
9-
Device: ./tests/unittest.sh tests/test_graphical_custom_keyboard.py ondevice
9+
Device: ./tests/unittest.sh tests/test_graphical_custom_keyboard.py --ondevice
1010
"""
1111

1212
import unittest

tests/test_graphical_custom_keyboard_basic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
Usage:
77
Desktop: ./tests/unittest.sh tests/test_custom_keyboard.py
8-
Device: ./tests/unittest.sh tests/test_custom_keyboard.py ondevice
8+
Device: ./tests/unittest.sh tests/test_custom_keyboard.py --ondevice
99
"""
1010

1111
import unittest

tests/test_graphical_keyboard_animation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
77
Usage:
88
Desktop: ./tests/unittest.sh tests/test_graphical_keyboard_animation.py
9-
Device: ./tests/unittest.sh tests/test_graphical_keyboard_animation.py ondevice
9+
Device: ./tests/unittest.sh tests/test_graphical_keyboard_animation.py --ondevice
1010
"""
1111

1212
import unittest

tests/test_graphical_keyboard_styling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
1414
Usage:
1515
Desktop: ./tests/unittest.sh tests/test_graphical_keyboard_styling.py
16-
Device: ./tests/unittest.sh tests/test_graphical_keyboard_styling.py ondevice
16+
Device: ./tests/unittest.sh tests/test_graphical_keyboard_styling.py --ondevice
1717
"""
1818

1919
import unittest

tests/unittest.sh

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,18 @@ mydir=$(dirname "$mydir")
55
testdir="$mydir"
66
scriptdir=$(readlink -f "$mydir"/../scripts/)
77
fs="$mydir"/../internal_filesystem/
8-
onetest="$1"
9-
ondevice="$2"
8+
9+
# Parse arguments
10+
ondevice=""
11+
onetest=""
12+
13+
for arg in "$@"; do
14+
if [ "$arg" = "--ondevice" ]; then
15+
ondevice="yes"
16+
else
17+
onetest="$arg"
18+
fi
19+
done
1020

1121

1222
# print os and set binary
@@ -95,19 +105,21 @@ else:
95105
failed=0
96106

97107
if [ -z "$onetest" ]; then
98-
echo "Usage: $0 [one_test_to_run.py] [ondevice]"
108+
echo "Usage: $0 [one_test_to_run.py] [--ondevice]"
99109
echo "Example: $0 tests/simple.py"
100-
echo "Example: $0 tests/simple.py ondevice"
110+
echo "Example: $0 tests/simple.py --ondevice"
111+
echo "Example: $0 --ondevice"
101112
echo
102113
echo "If no test is specified: run all tests from $testdir on local machine."
103114
echo
104-
echo "The 'ondevice' argument will try to run the test on a connected device using mpremote.py (should be on the PATH) over a serial connection."
115+
echo "The '--ondevice' flag will run the test(s) on a connected device using mpremote.py (should be on the PATH) over a serial connection."
105116
while read file; do
106117
one_test "$file"
107118
result=$?
108119
if [ $result -ne 0 ]; then
109120
echo "\n\n\nWARNING: test $file got error $result !!!\n\n\n"
110121
failed=$(expr $failed \+ 1)
122+
exit 1
111123
fi
112124
done < <( find "$testdir" -iname "test_*.py" )
113125
else

0 commit comments

Comments
 (0)