Page 1 of 1

How to run unit tests stored on host with mpremote?

Posted: Thu Aug 25, 2022 12:06 pm
by MicroRichard
Hi, i like to run unit tests stored on a Windows 10 host pc with mpremote. So basically the Pyboard D should run the unit_tests from this folder. I am not sure if this is possible.
The number of unit tests can quickly increase and until now i have stored them on the Pyboard D device which takes a lot of space.
To create unit tests i use the unittest.TestSuite().
Suppose i store all unit tests in a folder named c:\unit_test on my Windows 10 host pc. How can i run them using a script with mpremote?
Anyone done this before?

Re: How to run unit tests stored on host with mpremote?

Posted: Thu Aug 25, 2022 1:33 pm
by jimmo
MicroRichard wrote:
Thu Aug 25, 2022 12:06 pm
How can i run them using a script with mpremote?
mpremote is based on the pyboard.py tool (available as tools/pyboard.py in https://github.com/micropython/micropython)

pyboard.py is both a standalone tool, but also a library that can be used to script an interaction with a connected micropython device. Despite the name it works on all supported boards.

The documentation is here
https://docs.micropython.org/en/latest/ ... rd.py.html

(Specifically see the very end about how to use it as a library -- you can use pyb.execfile instead of pyb.exec for your use case).

Re: How to run unit tests stored on host with mpremote?

Posted: Fri Aug 26, 2022 2:58 am
by jimmo
I forgot to mention also, this may be relevant: https://github.com/BrianPugh/belay