Skip to main content

A pytest plugin for testing Jupyter libraries and extensions.

Project description


A set of pytest plugins for Jupyter libraries and extensions.

Build Status codecov

Basic Usage

First, install pytest-jupyter from PyPI using pip:

pip install pytest-jupyter

This installs the basic pytest-jupyter package that includes fixture definitions for the various Jupyter-based pytest plugins.

To use one of these plugins, you'll also need to install their dependencies. This requires a second pip install call. For example, if you'd like to use the jupyter_server plugin, you'll need to call:

pip install "pytest-jupyter[server]"

This should install everything you need for the plugin to work.

To use a plugin, add it to the pytest_plugins list in the of your project's root test directory.

# inside the

pytest_plugins = ["pytest_jupyter.jupyter_server"]

All fixtures inside the plugin (e.g. jupyter_server) will be available to all of your project's unit tests. You can use a fixtures by passing it as an argument to your unit test function:

async def test_jupyter_server_api(jp_fetch):
    # Send request to a temporary Jupyter Server Web Application
    response = await jp_fetch("api/spec.yml")

    # Confirm that the request is successful.
    assert response.code == 200

You can list the fixtures for a given plugin using the --fixtures argument from the pytest command line interface:

pytest --fixtures -p pytest_jupyter.jupyter_server

or by calling the pytest --fixtures where the plugin is listed in the pytest_plugins variable of a given test directory.

Project details

Download files

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

Source Distribution

pytest_jupyter-0.1.0.tar.gz (12.4 kB view hashes)

Uploaded Source

Built Distribution

pytest_jupyter-0.1.0-py3-none-any.whl (13.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page