Skip to content

Commit 5097d1a

Browse files
Add testing page and improve merge checklist
1 parent 2cf528a commit 5097d1a

File tree

3 files changed

+71
-7
lines changed

3 files changed

+71
-7
lines changed

docs/os-development/testing.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
By default, the unit tests will run automatically when the [GitHub workflows](https://github.com/MicroPythonOS/MicroPythonOS/tree/main/.github/workflows) are triggered.
2+
3+
But when you're working on a unit test, or investigating a failure, you probably want to run it locally for quick iteration.
4+
5+
The tests are stored in [tests/](https://github.com/MicroPythonOS/MicroPythonOS/tree/main/tests)
6+
7+
Simple (non-graphical) test filenames start with `test_` and ends with `.py`.
8+
9+
Graphical tests start with `test_graphical_` and also end with `.py`.
10+
11+
# On Desktop
12+
13+
The following assumes you have MicroPythonOS running on desktop, meaning this works:
14+
15+
```
16+
./scripts/run_desktop.sh
17+
```
18+
19+
Then you can run a specific unit test by providing its file as an argument:
20+
21+
```
22+
./tests/unittest.sh tests/test_package_manager.py
23+
```
24+
25+
To run all unit tests, do:
26+
27+
```
28+
./tests/unittest.sh
29+
```
30+
31+
This takes some time, during which you'll see the MicroPythonOS window pop up often.
32+
33+
There's also a syntax checker:
34+
35+
```
36+
./tests/syntax.sh
37+
```
38+
39+
# On Device
40+
41+
The unit tests can also run on a physical device, like an ESP32 that's connected with a USB cable, which is more representative and can help to test features that are not available on desktop.
42+
43+
This takes quite some time, because it restarts the device before each test, to make sure there's no leftover state from a previous test lingering.
44+
45+
The following assumes you have the MicroPythonOS REPL shell show up when you run mpremote.py, meaning this works:
46+
47+
```
48+
./lvgl_micropython/lib/micropython/tools/mpremote/mpremote.py ls
49+
```
50+
51+
Then you can run a specific unit test by adding the --ondevice option and providing its file as an argument:
52+
53+
```
54+
./tests/unittest.sh --ondevice tests/test_package_manager.py
55+
```
56+
57+
To run all unit tests, do:
58+
59+
```
60+
./tests/unittest.sh --ondevice # this takes a long time
61+
```
62+
63+

docs/other/merge-checklist.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ Before merging a pull request, we should consider the following:
22

33
Making sure to update related things:
44

5-
- has [CHANGELOG.md](https://github.com/MicroPythonOS/MicroPythonOS/blob/main/CHANGELOG.md) been updated?
6-
- has [MAINTAINERS.md](https://github.com/MicroPythonOS/MicroPythonOS/blob/main/MAINTAINERS.md) been updated?
7-
- has the app's version number (META-INF/MANIFEST.JSON) been incremented?
8-
- has the [documentation](https://GitHub.com/MicroPythonOS/docs) been updated?
5+
- does the "Future release (next version)" section at the top of [CHANGELOG.md](https://github.com/MicroPythonOS/MicroPythonOS/blob/main/CHANGELOG.md) need to be expanded?
6+
- does an App's version number (META-INF/MANIFEST.JSON) need incrementing? Normally only when you modify an App.
7+
- does the [documentation](https://GitHub.com/MicroPythonOS/docs) need updating? Usually when you modify or add a Framework, but can also be for other things. Always good!
8+
- does [MAINTAINERS.md](https://github.com/MicroPythonOS/MicroPythonOS/blob/main/MAINTAINERS.md) need to be updated? Usually only when adding a new board that you'll be maintaining.
99

1010
Making sure the logic is sound:
1111

12-
- if it changes a setting definition, will old settings be properly migrated to the new setting?
13-
- has a unit test been added or updated to make catch future regressions?
12+
- if it changes a Setting's definition, will old settings be properly migrated to the new setting?
13+
- did you add or expand one or more unit tests to make sure your code works, in all edge cases, and future regressions are caught?
1414

1515
Making sure it's easy to review:
1616

17-
- are whitespace changes done in a separate commit (or ideally, separate pull request) from functional changes?
17+
- are non-functional changes that result in a big diff done in a separate commit (or ideally, separate pull request) from functional changes?
1818

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ nav:
8383
- On MacOS: os-development/macos.md
8484
- On Windows: os-development/windows.md
8585
- Installing on ESP32: os-development/installing-on-esp32.md
86+
- Testing: os-development/testing.md
8687
- Emulated ESP32: os-development/emulating-esp32-on-desktop.md
8788
- Porting Guide: os-development/porting-guide.md
8889
- Other:

0 commit comments

Comments
 (0)