tests/run-tests.py: Update the list of tests requiring floats. by agatti · Pull Request #19111 · micropython/micropython · GitHub
Skip to content

tests/run-tests.py: Update the list of tests requiring floats.#19111

Open
agatti wants to merge 1 commit intomicropython:masterfrom
agatti:test-const
Open

tests/run-tests.py: Update the list of tests requiring floats.#19111
agatti wants to merge 1 commit intomicropython:masterfrom
agatti:test-const

Conversation

@agatti
Copy link
Copy Markdown
Contributor

@agatti agatti commented Apr 15, 2026

Summary

This PR updates the list of the tests that must be skipped when the suite is executed on a target that does not have floating point support.

Two more tests, namely extmod/vfs_rom.py and
micropython/const_float.py have been added to the list, since they both rely on floating point support being there.

There may be more of them but the test suite execution on my device reported these two - among other issues that maybe are in my code. The first test being skipped is quite unfortunate, since I just finished adding VFS support and turns out I had to patch the test bytecode too only to find out it was skipped :)

Testing

I've tested this with a port for CH32V microcontrollers I'm developing, but this can be replicated with any port with floats disabled.

Generative AI

I did not use generative AI tools when creating this PR.


There are a few tests that still expect higher ROM levels but do not get skipped if they cannot run (eg. micropython/emg_exc.py requiring tracebacks, and see also #17707).

I got bitten by unittest not running on a port configured with MICROPY_CONFIG_ROM_LEVEL_CORE_FEATURES and just enough to get by (eg. gc, io, sys, longint, compiler), due to a syntax error I have to track down, and that is probably hiding more issues.

I know I can add a new platform exclusion list, but I tried to see how much effort it'd take to make the test suite more resilient too.

This commit updates the list of the tests that must be skipped when the
suite is executed on a target that does not have floating point
support.

Two more tests, namely `extmod/vfs_rom.py` and
`micropython/const_float.py` have been added to the list, since they
both rely on floating point support being there.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 15, 2026

@dpgeorge
Copy link
Copy Markdown
Member

The first test being skipped is quite unfortunate, since I just finished adding VFS support

Yes, it's unfortunate that there's no ROMFS test that doesn't require float (or bigint). Because it is quite a normal thing to have a minimal target that uses ROMFS (eg 64k flash, no compiler, precompiled .mpy in a ROMFS). So maybe we need to make another, simpler ROMFS test that only has minimal dependencies?

and turns out I had to patch the test bytecode too only to find out it was skipped :)

What bytecode did you need to patch?

There are a few tests that still expect higher ROM levels but do not get skipped if they cannot run

Yes... there are a lot of configuration options so it's hard to cover everything, but I was thinking for a while now that it'd be good to build and run the test suite under CI for all of the possible ROM feature level config options (minimum, core, extra, full, everything). Could use the unix port for that, but it'd need a few tweaks. And we'd also want to combine some of those feature levels with float enabled/disabled.

I got bitten by unittest not running on a port

You mean unittest wasn't able to run, maybe due to f-strings? I wanted to remove f-strings from unittest, but never got around to it.

I know I can add a new platform exclusion list, but I tried to see how much effort it'd take to make the test suite more resilient too.

+1. We should try to make the test suite more resilient, but at the same time be careful not to automatically skip a bunch of things that should not be skipped. It's a hard trade off. See eg #19074.

Comment thread tests/run-tests.py
"extmod/uctypes_native_float.py",
"extmod/uctypes_sizeof_float.py",
"extmod/vfs_rom.py",
"micropython/const_float.py",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unix port minimal variant has float disabled, but already skips this test because const() is unavailable 🤷

@dpgeorge dpgeorge added the tests Relates to tests/ directory in source label Apr 16, 2026
@agatti
Copy link
Copy Markdown
Contributor Author

agatti commented Apr 16, 2026

agatti added a commit to agatti/micropython-lib that referenced this pull request Apr 16, 2026
This commit removes usage of f-strings from the unittest module, in
favour to the old printf-style raw string formatting operations.

The module is a bit special since it is meant to be also validate the
behaviour of MicroPython interpreters, and those may come with any
combination of configuration options.  For example, f-strings are not
available by default on some feature levels, and thus the test suite
won't run cleanly on certain targets unless the support for that feature
is explicitly enabled.

See the discussion at micropython/micropython#19111
for more information.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
agatti added a commit to agatti/micropython-lib that referenced this pull request Apr 16, 2026
This commit removes usage of f-strings from the unittest module, in
favour to the old printf-style raw string formatting operations.

The module is a bit special since it is meant to also validate the
behaviour of MicroPython interpreters, and those may come with any
combination of configuration options.  For example, f-strings are not
available by default on some feature levels, and thus the test suite
won't run cleanly on certain targets unless the support for that feature
is explicitly enabled.

See the discussion at micropython/micropython#19111
for more information.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
dpgeorge pushed a commit to agatti/micropython-lib that referenced this pull request Apr 21, 2026
This commit removes usage of f-strings from the unittest module, in
favour to the old printf-style raw string formatting operations.

The module is a bit special since it is meant to also validate the
behaviour of MicroPython interpreters, and those may come with any
combination of configuration options.  For example, f-strings are not
available by default on some feature levels, and thus the test suite
won't run cleanly on certain targets unless the support for that feature
is explicitly enabled.

See the discussion at micropython/micropython#19111
for more information.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
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