Metadata-Version: 2.1
Name: pytest-jupyter
Version: 0.1.0
Summary: A pytest plugin for testing Jupyter libraries and extensions.
Project-URL: Homepage, http://jupyter.org
Author-email: Jupyter Development Team <jupyter@googlegroups.com>
License: # Licensing terms
        
        This project is licensed under the terms of the Modified BSD License
        (also known as New or Revised or 3-Clause BSD), as follows:
        
        - Copyright (c) 2020-, Jupyter Development Team
        
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
        modification, are permitted provided that the following conditions are met:
        
        Redistributions of source code must retain the above copyright notice, this
        list of conditions and the following disclaimer.
        
        Redistributions in binary form must reproduce the above copyright notice, this
        list of conditions and the following disclaimer in the documentation and/or
        other materials provided with the distribution.
        
        Neither the name of the Jupyter Development Team nor the names of its
        contributors may be used to endorse or promote products derived from this
        software without specific prior written permission.
        
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
        ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
        WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
        DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
        FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
        SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
        CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
        OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
        OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
        
        ## About the Jupyter Development Team
        
        The Jupyter Development Team is the set of all contributors to the Jupyter project.
        This includes all of the Jupyter subprojects.
        
        The core team that coordinates development on GitHub can be found here:
        https://github.com/jupyter/.
        
        ## Our Copyright Policy
        
        Jupyter uses a shared copyright model. Each contributor maintains copyright
        over their contributions to Jupyter. But, it is important to note that these
        contributions are typically only changes to the repositories. Thus, the Jupyter
        source code, in its entirety is not the copyright of any single person or
        institution.  Instead, it is the collective copyright of the entire Jupyter
        Development Team.  If individual contributors want to maintain a record of what
        changes/contributions they have specific copyright on, they should indicate
        their copyright in the commit message of the change, when they commit the
        change to one of the Jupyter repositories.
        
        With this in mind, the following banner should be used in any source code file
        to indicate the copyright and license terms:
        
            # Copyright (c) Jupyter Development Team.
            # Distributed under the terms of the Modified BSD License.
License-File: LICENSE
Keywords: Jupyter,pytest
Classifier: Framework :: Pytest
Requires-Python: >=3.8
Requires-Dist: jupyter-core
Requires-Dist: pytest
Requires-Dist: pytest-asyncio
Provides-Extra: client
Requires-Dist: ipykernel>=6.14; extra == 'client'
Requires-Dist: jupyter-client>=7.4.0; extra == 'client'
Provides-Extra: docs
Requires-Dist: myst-parser; extra == 'docs'
Requires-Dist: pydata-sphinx-theme; extra == 'docs'
Requires-Dist: sphinx; extra == 'docs'
Provides-Extra: server
Requires-Dist: jupyter-server>=1.21; extra == 'server'
Requires-Dist: nbformat>=5.3; extra == 'server'
Requires-Dist: pytest-tornasync>=0.6; extra == 'server'
Provides-Extra: test
Requires-Dist: pytest-timeout; extra == 'test'
Description-Content-Type: text/markdown

# pytest-jupyter

A set of pytest plugins for Jupyter libraries and extensions.

[![Build Status](https://github.com/jupyter-server/pytest-jupyter/actions/workflows/test.yml/badge.svg?query=branch%3Amain++)](https://github.com/jupyter-server/pytest-jupyter/actions/workflows/test.yml/badge.svg?query=branch%3Amain++)
[![codecov](https://codecov.io/gh/jupyter-server/pytest-jupyter/branch/main/graph/badge.svg?token=2MY8C1A777)](https://codecov.io/gh/jupyter-server/pytest-jupyter)

## Basic Usage

First, install `pytest-jupyter` from PyPI using pip:

```bash
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:

```bash
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 `conftest.py` of your project's root test directory.

```python
# inside the conftest.py

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:

```python
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:

```bash
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.
