testing using micropython lib before deploying to target #13645
Replies: 3 comments 5 replies
-
If you are mainly interested in testing library and language compatibility issues with Cpython, the unix port is a really easy way to test your micropython code. The unix/windows port runs micropython on your local computer. It doesn't help with testing hardware though. Where feasible, I also like to build my app code in a modular manner and write tests for each component that makes it easy to deploy those tests onto the board individually before tying it all together into an app. I just use pytest on the computer to deploy and run the component tests on the board. |
Beta Was this translation helpful? Give feedback.
-
Note there is already a test_datetime.py in micropython's datetime module, though no idea if that actually passes all tests. But worth looking into befoer repeating everything it has. Anyway: the usual way to go here for something like this which arguably should be CPython-compatible is using the standard unittest module and:
|
Beta Was this translation helpful? Give feedback.
-
@steoj micropython-lib has a bit of a mix of different approaches to testing... Since the recent improvements to the (The general idea is to run them on the unix port of MicroPython... running them in CPython can be a bit tricky because many of the packages collide with the built-in names). |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
As is well known, the micropython library is not implementing all the standard lib functions, and I am trying to write tests using the micropython lib (with its limitations) on my python code before I deploy to target.
I found this interesting thread on testing Micropython, but this focuses mostly on stubbing or replacing u-prefixed libraries and hardware specific modules.
Anyone able to point me to good examples of testing actually including the python-stdlib modules in the micropython libraries?
Beta Was this translation helpful? Give feedback.
All reactions