Skip to main content


Project description

Plugin for pytest to run IPython notebooks as unit tests, relies on runipy to interface with the Notebook.

Define unit tests in IPython notebook cells (see example on nbviewer):

Example notebook

Run py.test to execute them:

Example output


See the examples/ folder or a preview on nbviewer.


  • Discover files named test*.ipynb
  • Run each cell of the notebook as a unit test (just use assert)
  • First line of each cell is the test name, either as docstring, comment or function name
  • A cell named fixture* or setup* is run before each of the following unit tests as a fixture
  • Add SKIPCI to a cell description to skip the test on Travis-CI (checks if the CI environment variable is defined)
  • IPython notebook kernel is restarted after each test
  • Each notebook is executed in the folder where the .ipynb file is located


  • Python 2.7+, Python 3.2+
  • pytest
  • IPython Notebook 2.0+


$ pip install pytest-ipynb


Andrea Zonca


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
pytest-ipynb-1.1.1.tar.gz (3.7 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page