This is a single-file module and an example sketch to get Processing.py users started with simple unit testing and test-driven development (TDD) by adding a single tests.py
file/tab.
Processing.py is Python Mode for Processing. It can be used to quickly wrap Python code together with the Processing Java API and distribute them as cross-platform sketches that run either as standalone apps or within the Processing IDE (PDE). Processing.py supports Python 2.7 running on the Jython 2.7 Python-on-Java interpreter. This includes the built-in unittest Unit Testing Framework.
This sketch demonstrates how to create and organize groups of unittest
tests and run them from a sketch, for example through tests.run()
You can get started using unittest in Processing.py sketches by either:
- downloading the example sketch and modifying it, or
- adding the tests.py file to an existing Processing.py sketch and calling it with run() from the main sketch.
If not already installed, you must:
- Download Processing 3.x
- In Processing, install Python Mode:
Processing > Tools > Add Tool > Modes > Python Mode
- Download or clone this repository.
- Launch the example in Processing by double-clicking
using_unittest.pyde
- Modify
tests.py
to add tests.
- Copy
tests.py
into the sketch folder, or create a new tabtests.py
in PDE, and copy-paste the contents in. - Modify
tests.py
to add tests. - In the main sketch file/tab:
- add
import tests
to the header - add
tests.run()
tosetup()
(or where appropriate)
- add
This project uses semantic versioning. For the versions available, see the tags on this repository.
This project is licensed under the Unlicense - see the LICENSE file for details.
- Jeremy Douglass - Initial work