Giter VIP home page Giter VIP logo

Comments (17)

pfalcon avatar pfalcon commented on July 22, 2024

@piranna, did you try to look into porting this yet?

from micropython.

piranna avatar piranna commented on July 22, 2024

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.

msiemens avatar msiemens commented on July 22, 2024

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.

piranna avatar piranna commented on July 22, 2024

Please don't doubt on ask me anything :-)

from micropython.

dpgeorge avatar dpgeorge commented on July 22, 2024

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.

piranna avatar piranna commented on July 22, 2024

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.

Neon22 avatar Neon22 commented on July 22, 2024

@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 avatar piranna commented on July 22, 2024

@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.

msiemens avatar msiemens commented on July 22, 2024

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.

pfalcon avatar pfalcon commented on July 22, 2024

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.

probar avatar probar commented on July 22, 2024

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.

dpgeorge avatar dpgeorge commented on July 22, 2024

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.

dhylands avatar dhylands commented on July 22, 2024

Sweet

from micropython.

pfalcon avatar pfalcon commented on July 22, 2024

I just pushed getattr() implementation, which was another missing piece to implement this stuff.

from micropython.

dpgeorge avatar dpgeorge commented on July 22, 2024

RPC on the pyboard now exists as tools/pyboard.py

from micropython.

pfalcon avatar pfalcon commented on July 22, 2024

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.

pfalcon avatar pfalcon commented on July 22, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.