A flexible and user-friendly snapshot testing plugin for pytest
Project description
pytest-insta
A flexible and user-friendly snapshot testing plugin for pytest.
assert snapshot() == "awesome!"
Introduction
Snapshot testing makes it easy to monitor and approve changes by comparing the result of an operation against a previous reference value.
This project borrows from a lot of other implementations to provide a pythonic, batteries included snapshot testing solution. It also tries to feel as native to pytest
as possible with its integrated reviewing tool.
Features
- Expressive and familiar assertion syntax
- Can format text, binary, hexdump, json and pickle snapshots out-of-the-box
- The plugin can be extended with custom snapshot formats
- Interactive reviewing tool for inspecting and approving changes
Credits
-
insta
(rust)Armin's work was the initial motivation for this project. It inspired the reviewing workflow by keeping everything as straightforward as possible. The name was pretty cool too.
-
jest
(javascript)Jest enabled the mass adoption of snapshot testing throughout the JavaScript ecosystem and now basically stands as the reference when it comes to what snapshot testing is supposed to look like.
Installation
The package can be installed with pip
.
$ pip install pytest-insta
Contributing
Contributions are welcome. Make sure to first open an issue discussing the problem or the new feature before creating a pull request. The project uses poetry
.
$ poetry install
You can run the tests with poetry run pytest
.
$ poetry run pytest
The project must type-check with mypy
and pylint
shouldn't report any error.
$ poetry run mypy
$ poetry run pylint pytest_insta tests
The code follows the black
code style. Import statements are sorted with isort
.
$ poetry run isort pytest_insta tests
$ poetry run black pytest_insta tests
$ poetry run black --check pytest_insta tests
License - MIT
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
Hashes for pytest_insta-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a9c2866a46a79971abb63aeadceee7e88ac02de286851adfa012ce3295b4d06 |
|
MD5 | 603f9ff0e650c5358977c4fc396e85b4 |
|
BLAKE2b-256 | f64ad5ff3e2f480f802ce1ec882af2b43274878179777c44ffaa39404c832504 |