A pytest plugin for executing Jupyter Notebooks as tests
Project description
pytest-testbook
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-testbookmanagedplaywrightinstance.- 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0236272939f588fddbaf38b6de64b309bbebfb91695eaa25fb17ffaf93c8b708
|
|
| MD5 |
db3e3d3ddebb84d57659064d116cb2fc
|
|
| BLAKE2b-256 |
2be7f25b424af44333a2e59df6f11cdb2a34d5316e6d6c4d6cdcbaa126fe72e3
|
File details
Details for the file pytest_testbook-1.2.6-py3-none-any.whl.
File metadata
- Download URL: pytest_testbook-1.2.6-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75c9c9e218f03495705d38e4c8981cd879099207c0ff341fbf879874cc6286a9
|
|
| MD5 |
d4c69658e6a9a45eb88d0f7499e2784d
|
|
| BLAKE2b-256 |
45611dc902154a16fb28919c9d5be3108228a275b9299ce8f9e43a892b345535
|