Every feature should come along with a unit test #13436
Replies: 7 comments 23 replies
-
@aguaviva MicroPython has 98% code coverage, the unit testing of the core VM, compiler, emitters, runtime, standard library and more is exhaustive. Occasionally we miss things (Python has a lot of corner cases), but we continue to add new tests as things are found (and as features are added). These tests run continuously in CI on several different configurations of MicroPython on a range of architectures and platforms, and we also run them on a range of hardware before every release. Can you give an example of a feature that doesn't have a unit test? We also have a fairly extensive set of integration tests, most of which run on hardware, including multi-device tests with networking and bluetooth. The main thing we currently lack is completely automated hardware-in-the-loop integration tests. We do this manually before releases at the moment. |
Beta Was this translation helpful? Give feedback.
-
Man, today, yet another I2C bug (#13536) that could have been caught using unit tests. Good luck fixing it and touch wood the fix for it wont be breaking another platform. |
Beta Was this translation helpful? Give feedback.
-
That is not a bug. It's the way the hardware works. Similar behavior for ESP32. |
Beta Was this translation helpful? Give feedback.
-
Arguably it's just a new feature request - dynamically chaning pins at runtime while peripheral is running has never been a requested or documented feature before. So even if there were hardware in the loop tests written, no way they'd be covering functionality like this. Again, just because someone raises an issue here relating to a praticular hardware like I2C does not mean it's a bug in the micropython codebase! |
Beta Was this translation helpful? Give feedback.
-
@jimmo I've just put together this https://github.com/Carglglz/micropython-localCI, so it should be fairly easy to automate it now. 👍🏼 |
Beta Was this translation helpful? Give feedback.
-
We've recently been looking at renode (https://renode.io/about/) which allows simulation of the entire hardware. Has anyone played with it, or considered it for CI in micropython? |
Beta Was this translation helpful? Give feedback.
-
Just start small, and see where that leads. What do you have to lose? Do you really believe this is going to be wasted time? |
Beta Was this translation helpful? Give feedback.
-
This is a usual practice in many projects as it helps increase the quality of the code by catching issues very early.
Does this sound like a reasonable request?
Beta Was this translation helpful? Give feedback.
All reactions