Skip to content

tests: Rewrite with unittest the select/socket tests that use UDP.#19333

Open
dpgeorge wants to merge 2 commits into
micropython:masterfrom
dpgeorge:tests-extmod-dont-open-port-on-cpython
Open

tests: Rewrite with unittest the select/socket tests that use UDP.#19333
dpgeorge wants to merge 2 commits into
micropython:masterfrom
dpgeorge:tests-extmod-dont-open-port-on-cpython

Conversation

@dpgeorge

Copy link
Copy Markdown
Member

Summary

Three tests are rewritten using unittest, so that they don't need to be run under CPython to get the expected output. Because running under CPython requires port 8000 to be available, which it may not (at least for tests in the extmod directory having a port available should not be a requirement).

And one test had a .py.exp file added, for the same reason (so CPython doesn't need to be run).

This was motivated by some failures in Octoprobe, where tests failed because CPython could not run the test to get the expected output, because port 8000 was in use (the tests otherwise run on target boards, not the host micropython).

Testing

To be tested by CI, and Octoprobe.

Trade-offs and Alternatives

This gives a bit of churn, but unittest is arguably a better choice for finicky tests like these, it makes it easy to understand what it's testing, and extend it in the future.

Running the tests on local micropython executables still requires port 8000 to be available, but that's a harder problem to solve, and isn't an issue with Octoprobe (which only tests hardware targets).

Generative AI

Not used.

dpgeorge added 2 commits June 11, 2026 22:42
Three tests are rewritten using unittest, so that they don't need to be run
under CPython to get the expected output.  Because running under CPython
requires port 8000 to be available, which it may not (at least for tests in
the extmod directory having a port available should not be a requirement).

Signed-off-by: Damien George <damien@micropython.org>
Similar to the parent commit, this means CPython doesn't need to run to get
the expected output, and means port 8000 doesn't need to be available.

Signed-off-by: Damien George <damien@micropython.org>
@dpgeorge dpgeorge added the tests Relates to tests/ directory in source label Jun 11, 2026
@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.49%. Comparing base (7b06871) to head (bbc4d50).

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #19333   +/-   ##
=======================================
  Coverage   98.49%   98.49%           
=======================================
  Files         176      176           
  Lines       22911    22911           
=======================================
  Hits        22566    22566           
  Misses        345      345           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@octoprobe-bot

Copy link
Copy Markdown

Octoprobe PR report

Test Tests
passed
Tests
skipped
Tests
xfailed
Tests
failed
format flash 10 9
run-tests.py 16544 2211 8 1
run-tests.py --via-mpy --emit native 16903 2873 19 4
run-tests.py --via-mpy 16568 2177 8 1
run-perfbench.py 436 15 2
run-natmodtests.py 629 148 2
run-tests.py --test-dirs=extmod_hardware 58 94 24 4
run-tests.py --test-dirs=extmod_hardware --emit-native 58 96 24 2
Total 51206 7623 87 12
Failures

Group: run-tests.py --test-dirs=extmod_hardware

Test esp32
0c30-
ESP32_C3_DEVKIT
esp32
5d21-
ESP32_DEVKIT
esp32
472b-
ESP32_S3_DEVKIT
esp32
1830-
LOLIN_C3_MINI
esp8266
2d2d-
LOLIN_D1_MINI
mimxrt
1133-
TEENSY40
nrf
3c2a-
ARDUINO_NANO_33
rp2
5334-
RPI_PICO2
rp2
5334-
RPI_PICO2-
RISCV
rp2
552b-
RPI_PICO2_W
rp2
5f2c-
RPI_PICO_W
rp2
6038-
RPI_PICO_W
samd
5f2a-
ADA_ITSYBITSY_M0
stm32
2b35-
NUCLEO_WB55
stm32
3a21-
PYBV11
stm32
3a21-
PYBV11-
DP
stm32
3a21-
PYBV11-
DP_THREAD
stm32
3a21-
PYBV11-
THREAD
extmod_hardware/machine_pwm.py pass pass pass pass pass
xfail_master_478.json
pass skip XFAIL
xfail_master_478.json
XFAIL
xfail_master_478.json
pass FAIL FAIL pass pass pass pass pass pass
extmod_hardware/machine_sdcard_dma_align.py FAIL skip skip FAIL skip skip skip skip skip skip skip skip skip skip skip skip skip skip

Group: run-tests.py --test-dirs=extmod_hardware --emit-native

Test esp32
0c30-
ESP32_C3_DEVKIT
esp32
5d21-
ESP32_DEVKIT
esp32
472b-
ESP32_S3_DEVKIT
esp32
1830-
LOLIN_C3_MINI
esp8266
2d2d-
LOLIN_D1_MINI
mimxrt
1133-
TEENSY40
nrf
3c2a-
ARDUINO_NANO_33
rp2
5334-
RPI_PICO2
rp2
5334-
RPI_PICO2-
RISCV
rp2
552b-
RPI_PICO2_W
rp2
5f2c-
RPI_PICO_W
rp2
6038-
RPI_PICO_W
samd
5f2a-
ADA_ITSYBITSY_M0
stm32
2b35-
NUCLEO_WB55
stm32
3a21-
PYBV11
stm32
3a21-
PYBV11-
DP
stm32
3a21-
PYBV11-
DP_THREAD
stm32
3a21-
PYBV11-
THREAD
extmod_hardware/machine_sdcard_dma_align.py FAIL skip skip FAIL skip skip skip skip skip skip skip skip skip skip skip skip skip skip

Group: run-tests.py

Test esp32
0c30-
ESP32_C3_DEVKIT
esp32
5d21-
ESP32_DEVKIT
esp32
472b-
ESP32_S3_DEVKIT
esp32
1830-
LOLIN_C3_MINI
esp8266
2d2d-
LOLIN_D1_MINI
mimxrt
1133-
TEENSY40
nrf
3c2a-
ARDUINO_NANO_33
rp2
5334-
RPI_PICO2
rp2
5334-
RPI_PICO2-
RISCV
rp2
552b-
RPI_PICO2_W
rp2
5f2c-
RPI_PICO_W
rp2
6038-
RPI_PICO_W
samd
5f2a-
ADA_ITSYBITSY_M0
stm32
2b35-
NUCLEO_WB55
stm32
3a21-
PYBV11
stm32
3a21-
PYBV11-
DP
stm32
3a21-
PYBV11-
DP_THREAD
stm32
3a21-
PYBV11-
THREAD
extmod/vfs_blockdev_invalid.py pass pass pass pass FAIL pass skip pass pass pass pass pass skip pass pass pass pass pass

Group: run-tests.py --via-mpy --emit native

Test esp32
0c30-
ESP32_C3_DEVKIT
esp32
5c34-
ESP32_C3_DEVKIT
esp32
5d21-
ESP32_DEVKIT
esp32
472b-
ESP32_S3_DEVKIT
esp32
1830-
LOLIN_C3_MINI
esp8266
2d2d-
LOLIN_D1_MINI
mimxrt
1133-
TEENSY40
nrf
3c2a-
ARDUINO_NANO_33
rp2
5334-
RPI_PICO2
rp2
5334-
RPI_PICO2-
RISCV
rp2
552b-
RPI_PICO2_W
rp2
5f2c-
RPI_PICO_W
rp2
6038-
RPI_PICO_W
samd
5f2a-
ADA_ITSYBITSY_M0
stm32
2b35-
NUCLEO_WB55
stm32
3a21-
PYBV11
stm32
3a21-
PYBV11-
DP
stm32
3a21-
PYBV11-
DP_THREAD
stm32
3a21-
PYBV11-
THREAD
basics/int_big_error.py pass pass pass pass pass FAIL pass pass pass pass pass pass pass pass pass pass pass pass pass
micropython/viper_ptr16_load_boundary.py pass pass pass pass pass skip pass pass pass pass pass pass pass FAIL pass pass pass pass pass
micropython/viper_ptr32_load_boundary.py pass pass pass pass pass skip pass pass pass pass pass pass pass FAIL pass pass pass pass pass
stress/qstr_limit.py pass pass pass pass pass skip pass pass pass pass pass pass pass FAIL pass pass pass pass pass

Group: run-tests.py --via-mpy

Test esp32
0c30-
ESP32_C3_DEVKIT
esp32
5c34-
ESP32_C3_DEVKIT
esp32
5d21-
ESP32_DEVKIT
esp32
472b-
ESP32_S3_DEVKIT
esp32
1830-
LOLIN_C3_MINI
esp8266
2d2d-
LOLIN_D1_MINI
mimxrt
1133-
TEENSY40
nrf
3c2a-
ARDUINO_NANO_33
rp2
5334-
RPI_PICO2
rp2
5334-
RPI_PICO2-
RISCV
rp2
552b-
RPI_PICO2_W
rp2
5f2c-
RPI_PICO_W
rp2
6038-
RPI_PICO_W
samd
5f2a-
ADA_ITSYBITSY_M0
stm32
2b35-
NUCLEO_WB55
stm32
3a21-
PYBV11
stm32
3a21-
PYBV11-
DP_THREAD
stm32
3a21-
PYBV11-
THREAD
extmod/vfs_blockdev_invalid.py pass pass pass pass pass FAIL pass skip pass pass pass pass pass skip pass pass pass pass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Relates to tests/ directory in source

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants