tests/run-tests.py: Update the list of tests requiring floats.#19111
tests/run-tests.py: Update the list of tests requiring floats.#19111agatti wants to merge 1 commit intomicropython:masterfrom
Conversation
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>
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?
What bytecode did you need to patch?
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.
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.
+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. |
| "extmod/uctypes_native_float.py", | ||
| "extmod/uctypes_sizeof_float.py", | ||
| "extmod/vfs_rom.py", | ||
| "micropython/const_float.py", |
There was a problem hiding this comment.
The unix port minimal variant has float disabled, but already skips this test because const() is unavailable 🤷
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>
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>
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>

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.pyandmicropython/const_float.pyhave 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.pyrequiring tracebacks, and see also #17707).I got bitten by
unittestnot running on a port configured withMICROPY_CONFIG_ROM_LEVEL_CORE_FEATURESand 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.