Comments (17)
@piranna, did you try to look into porting this yet?
from micropython.
Sorry, I didn't look on porting this, and currently I'm really busy with lessons and work. If you want you can take on it, I don't think it should be too dificult since PyUnit/UnitTest module is written in pure python...
from micropython.
I'd love to take a shot on this. I'm fairly new to C development but pretty fluent in Python, so I surely would learn a thing or two :)
from micropython.
Please don't doubt on ask me anything :-)
from micropython.
If it's written in pure Python (v3) then it would be a good way to test uPy itself, to see how well (or not!) it conforms to Python.
from micropython.
Seems PyUnit since it got integrated on Python source code it was not available outside and got outdated, maybe it's better to try it with unittest2, the backport version with the upcoming changes.
And yes, I proposed also as a self-test for uPy ;-)
from micropython.
@piranna I think I misunderstand you.
PyUnit is the name for the python unit testing framework - which is exposed in python 3.3 as the unittest module.
docs here: http://docs.python.org/3/library/unittest.html#module-unittest
It appears in your python 3.3 source tree in lib/unittest
as a pile of python files.
unittest2 is a backport of unittest for python 2.4, 2.6 but as the python is in 3.3 version - why do suggest unittest2 ?
I know I'm missing something, apologies in advance.
from micropython.
@piranna I think I misunderstand you.
PyUnit is the name for the python unit testing framework - which is
exposed in python 3.3 as the unittest module.
docs here: http://docs.python.org/3/library/unittest.html#module-unittest
It appears in your python 3.3 source tree in lib/unittest as a pile of
python files.unittest2 is a backport of unittest for python 2.4, 2.6 but as the python
is in 3.3 version - why do suggest unittest2 ?
I know I'm missing something, apologies in advance.I proposed unittest2 because I didn't know where the PyUnit/unittest code
integrated on Python source code was, but both should be equivalent if not
the same. If the integrated one is located at lib/unittest, don't doubt it
and use it since it's the official, good one.
This kind of things is why I don't understand the reason python modules are
not in an independent source tree in CPython, you can't be able to locate
and reuse them easily on other projects. Maybe we could start doing it us
on MicroPython putting the ported modules like unittest in an independent
repo (github.com/micropython/python-modules, for instance)?
from micropython.
I'm facing problems now. Currently uPy's import
statement is very minimal. It only imports mod_name.py
, no support for mod_name/__init__.py
nor import mod_name.SomeClass
or from mod_name import SomeClass
(the last two result in failed asserts in compile.c
, line 1197).
I was able to let uPy try to import mod_name/__init__.py
, but am struggling with the rest. I'll propably will have to wait, until we have a more powerfull import
(or use a big fat file without any imports -- but who would want that?).
from micropython.
Note that I'm working on import code to support sys.path. We apparently need to get decent module import support before going to support packages. But you're of course welcome to prototype how it would work - it won't appear on its own, someone who needs it will need to implement it (and my guess that MCU usage which is direct target of uPy can live happily without packages for quite some time).
from micropython.
What about a python testing library running on the pc using full python , controlling the board through an remote procedure call ?
This way , we'll get remote procedure call library and an ability to test python using more testing tools(for example quickcheck ) and the full power of python ?
from micropython.
There is now a way of doing RPC on the pyboard: you can enter raw REPL mode by using CTRL-A. This allows you to send arbitrary Python code to the board over the USB serial connection, and get the result back. I have written a small Python class that runs on the PC, which allows you to do pyboard.exec('....') and pyboard.eval('...'). I'll add it to the repo after I tidy it up.
from micropython.
Sweet
from micropython.
I just pushed getattr() implementation, which was another missing piece to implement this stuff.
from micropython.
RPC on the pyboard now exists as tools/pyboard.py
from micropython.
I did some hacking to run unittest-based tests in adhoc manner, and put up outcome of it here: https://github.com/micropython/micropython-lib/blob/master/unittest/unittest.py . Contributions are welcome.
from micropython.
micropython-unittest 0.0.5 has just been released to PyPI: https://pypi.python.org/pypi/micropython-unittest/0.0.5 . The module now has more than a kilobyte of code and can run almost complete non-trivial tests (specifically, test_urlparse.py from CPython 3.3.3 distro, without Unicode tests).
Closing this, please report further issues against micropython-lib.
from micropython.
Related Issues (20)
- network: wiznet: send_ethernet
- network: wiznet: zeroconf HOT 2
- Please add 'v1.24.0-preview' Git tag for mpy-cross headers generating properly HOT 1
- ESP32: Unable to use SDCard and any other SPI device in the same bus HOT 2
- libhydrogen error when trying to build mboot with packing enabled
- Cryptolib throws ValueError HOT 2
- Two instances of main code appeared HOT 2
- asyncio: Calling .run() within a task does not behave as per CPython
- rpi2040 gives correct output on logic analizer for 8bit but not for 9bit communication HOT 12
- RP2 Hanging on file write after soft reboot when a thread was started HOT 4
- UART device only responds when running in REPL, but not when running standalone on Raspberry Pi Pico W
- Unable to flash firmware via fwupdate.py on micropython 1.23.0 HOT 5
- Flash corruption after failed file copy with rshell HOT 1
- ImportError: No module named 'bluetooth' HOT 3
- ESP32+SPIRAM Neopixel issue since v1.22.0 HOT 2
- py: Error freezing a python source file with concatenated f-strings HOT 4
- rp2: Pico W, hang setting up board LED HOT 5
- Unable to print unicode characters when running repl with mpremote
- [RP2] Not getting serial device with 1.23 (good with prior versions) HOT 3
- round() returns incorrect results HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from micropython.