Skip to main content

Build Status image Documentation Status Python 3.6 Python 3.7 Python 3.8 Code style: black

testbook

WARNING: This is the old package name nteract-testbook -- please install testbook in the future as no new releases are going out for this old package name.

testbook is a unit testing framework extension for testing code in Jupyter Notebooks.

Previous attempts at unit testing notebooks involved writing the tests in the notebook itself. However, testbook will allow for unit tests to be run against notebooks in separate test files, hence treating .ipynb files as .py files.

testbook helps you set up conventional unit tests for your Jupyter Notebooks.

Here is an example of a unit test written using testbook

Consider the following code cell in a Jupyter Notebook:

def sum(a, b):
   return a + b

You would write a unit test using testbook in a Python file as follows:

import testbook



@testbook.testbook('/path/to/notebook.ipynb', execute=True)
def test_notebook(tb):
   sum = tb.ref("sum")

   assert sum(1, 2) == 3

Installing testbook

pip install nteract-testbook

Documentation

See readthedocs for more in-depth details.

Development Guide

Read CONTRIBUTING.md for guidelines on how to setup a local development environment and make code changes back to testbook.

Release files for nteract-testbook 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for nteract-testbook 0.1.3
File Interpreter ABI Platform
nteract_testbook-0.1.3-py3-none-any.whl Python 3 none any Details

Release files / nteract_testbook-0.1.3-py3-none-any.whl

Download URL nteract_testbook-0.1.3-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
913b40fbbd8114d293becc88980bad7a7567dbbb1a38361361825fe983c2e4d8
BLAKE2b-256 checksum
How to use checksums
3dc540bc4d8d3302d5c195239dcddae78a69e6afbd785ff7ff46be21363f4a11
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

Release history Release notifications | RSS feed

This release

0.1.3 This release

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page