py.test to write unit tests as cells in IPython notebooks:
- Homepage on Github: https://github.com/zonca/pytest-ipynb
- PyPi : https://pypi.python.org/pypi/pytest-ipynb/
- Install with
pip install pytest-ipynb
Many unit testing fromeworks in Python, first of all the
unittest package in the standard library, work very well for automating unit tests, but make it very difficult to debug interactively any failed test.
py.test alleviates this problem by allowing to write just plain Python functions with
assert statements (no boilerplate code), discover them automatically in any file that starts with
test and write a useful report.
I wrote a plugin for
pytest-ipynb, that goes a step further and runs unit tests written as cells of any IPython notebook named
The advantage is that it is easy to create and debug interactively any issue by opening the testing notebook interactively, then clean the notebook outputs and add it to the software repository.
More details on Github: https://github.com/zonca/pytest-ipynb
Suggestions welcome as comments or github issues.
(Yes, works with Python 3)