pytest-jupyter


Namepytest-jupyter JSON
Version 0.10.1 PyPI version JSON
download
home_pageNone
SummaryA pytest plugin for testing Jupyter libraries and extensions.
upload_time2024-04-04 11:49:34
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
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. Pytest Tornasync File License ============================= The pytest_jupyter/pytest_tornasync.py was originally licensed as: The MIT License (MIT) Copyright (c) 2016 eukaryote Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords jupyter pytest
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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++)

## 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"]
```

This library includes an `echo_kernel`, which is useful to speed up testing.
You must have either `"pytest-jupyter[server]"` or `"pytest-jupyter[client]"`
installed to use the echo kernel.

The `pytest_jupyter.jupyter_client` plugin provides an installed
`echo_kernel_spec` as a fixture, and a `start_kernel` fixture
that provides a factory function that starts a kernel using the `echo` kernel
by default.

*Note*: The server plugin also includes the client plugin, so you can use both
sets of fixtures with `"pytest_jupyter.jupyter_server"`.  Both the `client`
and `server` plugins also include the core fixtures.

*Note*: The client and server plugins use `pytest-tornasync` for async
test suite running.  It may not compatible with `pytest-asyncio`, meaning
that all fixtures must be synchronous.  You can use the `asyncio_loop` fixture
and run `asyncio_loop.run_until_complete` against an async function in your
fixtures if needed.

The server fixures use the echo kernel by default.  To override this behavior,
override the `jp_server_config` fixture and add the following config:

```json
{
    "MultiKernelManager": {
        "default_kernel_name": "<desired_kernel_name"
    }
}
```

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.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pytest-jupyter",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "Jupyter, pytest",
    "author": null,
    "author_email": "Jupyter Development Team <jupyter@googlegroups.com>",
    "download_url": "https://files.pythonhosted.org/packages/40/5d/cac168223047ddf90d69d2e03958e1eb07b011b5013f5ec8f241eea3ba76/pytest_jupyter-0.10.1.tar.gz",
    "platform": null,
    "description": "# pytest-jupyter\n\nA set of pytest plugins for Jupyter libraries and extensions.\n\n[![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++)\n\n## Basic Usage\n\nFirst, install `pytest-jupyter` from PyPI using pip:\n\n```bash\npip install pytest-jupyter\n```\n\nThis installs the basic pytest-jupyter package that includes fixture definitions for the various Jupyter-based pytest plugins.\n\nTo 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:\n\n```bash\npip install \"pytest-jupyter[server]\"\n```\n\nThis *should* install everything you need for the plugin to work.\n\nTo use a plugin, add it to the `pytest_plugins` list in the `conftest.py` of your project's root test directory.\n\n```python\n# inside the conftest.py\n\npytest_plugins = [\"pytest_jupyter.jupyter_server\"]\n```\n\nThis library includes an `echo_kernel`, which is useful to speed up testing.\nYou must have either `\"pytest-jupyter[server]\"` or `\"pytest-jupyter[client]\"`\ninstalled to use the echo kernel.\n\nThe `pytest_jupyter.jupyter_client` plugin provides an installed\n`echo_kernel_spec` as a fixture, and a `start_kernel` fixture\nthat provides a factory function that starts a kernel using the `echo` kernel\nby default.\n\n*Note*: The server plugin also includes the client plugin, so you can use both\nsets of fixtures with `\"pytest_jupyter.jupyter_server\"`.  Both the `client`\nand `server` plugins also include the core fixtures.\n\n*Note*: The client and server plugins use `pytest-tornasync` for async\ntest suite running.  It may not compatible with `pytest-asyncio`, meaning\nthat all fixtures must be synchronous.  You can use the `asyncio_loop` fixture\nand run `asyncio_loop.run_until_complete` against an async function in your\nfixtures if needed.\n\nThe server fixures use the echo kernel by default.  To override this behavior,\noverride the `jp_server_config` fixture and add the following config:\n\n```json\n{\n    \"MultiKernelManager\": {\n        \"default_kernel_name\": \"<desired_kernel_name\"\n    }\n}\n```\n\nAll 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:\n\n```python\nasync def test_jupyter_server_api(jp_fetch):\n    # Send request to a temporary Jupyter Server Web Application\n    response = await jp_fetch(\"api/spec.yml\")\n\n    # Confirm that the request is successful.\n    assert response.code == 200\n```\n\nYou can list the fixtures for a given plugin using the `--fixtures` argument from the pytest command line interface:\n\n```bash\npytest --fixtures -p pytest_jupyter.jupyter_server\n```\n\nor by calling the `pytest --fixtures` where the plugin is listed in the `pytest_plugins` variable of a given test directory.\n",
    "bugtrack_url": null,
    "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.   Pytest Tornasync File License =============================  The pytest_jupyter/pytest_tornasync.py was originally licensed as:  The MIT License (MIT)  Copyright (c) 2016 eukaryote  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "A pytest plugin for testing Jupyter libraries and extensions.",
    "version": "0.10.1",
    "project_urls": {
        "Funding": "https://numfocus.org/donate",
        "Homepage": "http://jupyter.org",
        "Source": "https://github.com/jupyter-server/pytest-jupyter",
        "Tracker": "https://github.com/jupyter-server/pytest-jupyter/issues"
    },
    "split_keywords": [
        "jupyter",
        " pytest"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "87950166c428ea0ab4770f66de7804f2341caa9d8826d0022ce3d986d253d9c6",
                "md5": "4d2386faf858f20d632dcebcf5c75fc1",
                "sha256": "644ae23821fe74344e1ff4dfcdbbcd1d6ffc191f654f435f67a19e6dce141684"
            },
            "downloads": -1,
            "filename": "pytest_jupyter-0.10.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4d2386faf858f20d632dcebcf5c75fc1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 17677,
            "upload_time": "2024-04-04T11:49:32",
            "upload_time_iso_8601": "2024-04-04T11:49:32.188199Z",
            "url": "https://files.pythonhosted.org/packages/87/95/0166c428ea0ab4770f66de7804f2341caa9d8826d0022ce3d986d253d9c6/pytest_jupyter-0.10.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "405dcac168223047ddf90d69d2e03958e1eb07b011b5013f5ec8f241eea3ba76",
                "md5": "13c4f91e9b658dc8621057606f3a3023",
                "sha256": "00df54eef9e201dd542d5471b8980def15d34b917b30587d14d7c824fc4d9e84"
            },
            "downloads": -1,
            "filename": "pytest_jupyter-0.10.1.tar.gz",
            "has_sig": false,
            "md5_digest": "13c4f91e9b658dc8621057606f3a3023",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 15580,
            "upload_time": "2024-04-04T11:49:34",
            "upload_time_iso_8601": "2024-04-04T11:49:34.152053Z",
            "url": "https://files.pythonhosted.org/packages/40/5d/cac168223047ddf90d69d2e03958e1eb07b011b5013f5ec8f241eea3ba76/pytest_jupyter-0.10.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-04 11:49:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jupyter-server",
    "github_project": "pytest-jupyter",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pytest-jupyter"
}
        
Elapsed time: 0.29979s