Skip to content

Port PyUnit/UnitTest module #44

Description

@piranna

It's the standard Python test library, and this way the tests would be done in an automatically way directly from inside the board... :-)

http://pyunit.sourceforge.net/
http://docs.python.org/3.3/library/unittest.html

Activity

  1. pfalcon commented on Jan 30, 2014

    @pfalcon
    Contributor

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

  2. piranna commented on Jan 30, 2014

    @piranna
    Author

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

  3. msiemens commented on Jan 30, 2014

    @msiemens
    Contributor

    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 :)

  4. piranna commented on Jan 30, 2014

    @piranna
    Author

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

  5. dpgeorge commented on Jan 30, 2014

    @dpgeorge
    Member

    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.

  6. piranna commented on Jan 30, 2014

    @piranna
    Author

    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 ;-)

  7. Neon22 commented on Feb 3, 2014

    @Neon22
    Contributor

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

  8. piranna commented on Feb 3, 2014

    @piranna
    Author

    @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)?

  9. msiemens commented on Feb 4, 2014

    @msiemens
    Contributor

    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?).

  10. pfalcon commented on Feb 4, 2014

    @pfalcon
    Contributor

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

  11. probar commented on Mar 16, 2014

    @probar

    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 ?

  12. dpgeorge commented on Mar 20, 2014

    @dpgeorge
    Member

    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.

  13. dhylands commented on Mar 21, 2014

    @dhylands
    Contributor

    Sweet

  14. pfalcon commented on Mar 26, 2014

    @pfalcon
    Contributor

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

  15. dpgeorge commented on Mar 26, 2014

    @dpgeorge
    Member

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

  16. 8 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions