Skip to main content

A pytest plugin for executing Jupyter Notebooks as tests

Project description

pytest-testbook

Build Status See Build Status on AppVeyor

Question

What do you call a Jupyter Notebook filled with test cases?

Answer

a testbook !

Why invent this plugin?

Because no one can stop you from jotting your test cases inside Jupyter Notebook. In the same way that no one can stop your BA from writing their requirements inside that same Notebook. Moreover, no one can stop the test automation engineer from writing test automation code in that same Notebook. When requirements, test cases, and automation code are written in one single Notebook, this becomes a Testbook.

Features

  • PDF reports for auditing purposes.
  • pytest-testbook managed playwright instance.
  • BDD-style tests.
  • Run tests manually in Jupyter or automated using pytest

Installation

You will need playwright to generate pdf test reports. The side-effect is that you get a free playwright instance that you can use in your Testbooks.

pip install pytest-testbook
pip install jupyterlab
playwright install chromium

Usage

Navigate to where your tests folder are located. Then either run:

jupyter lab

to run tests manually in Jupyter. Or you can run:

pytest -sv

instead to let pytest discover your tests, collect them and execute them.

Contributing

Contributions are very welcome. Tests can be run with tox_, please ensure the coverage at least stays the same before you submit a pull request.

License

Distributed under the terms of the MIT_ license, "pytest-testbook" is free and open source software

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_testbook-1.2.6.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_testbook-1.2.6-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file pytest_testbook-1.2.6.tar.gz.

File metadata

  • Download URL: pytest_testbook-1.2.6.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for pytest_testbook-1.2.6.tar.gz
Algorithm Hash digest
SHA256 0236272939f588fddbaf38b6de64b309bbebfb91695eaa25fb17ffaf93c8b708
MD5 db3e3d3ddebb84d57659064d116cb2fc
BLAKE2b-256 2be7f25b424af44333a2e59df6f11cdb2a34d5316e6d6c4d6cdcbaa126fe72e3

See more details on using hashes here.

File details

Details for the file pytest_testbook-1.2.6-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_testbook-1.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 75c9c9e218f03495705d38e4c8981cd879099207c0ff341fbf879874cc6286a9
MD5 d4c69658e6a9a45eb88d0f7499e2784d
BLAKE2b-256 45611dc902154a16fb28919c9d5be3108228a275b9299ce8f9e43a892b345535

See more details on using hashes here.

Supported by

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