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 but reinterprets what it means to work with snapshots in an expressive language like Python. It also tries to feel as native to pytest
as possible with its integrated reviewing tool.
Features
- Expressive and familiar assertion syntax
- Named and unnamed snapshots
- Handles text, binary, hexdump, json and pickle snapshots out-of-the-box
- The plugin can be extended with custom snapshot formats
- Integrated reviewing tool with live repl for inspecting the new value and the old value
Credits
-
insta
(rust)Armin's work was the initial inspiration for this project and shaped the reviewing workflow. The name was 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. This 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.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60cbf43f0e68149a4cb6b8eeacf42aae638ace3f4e6bdcbef2ac58fc1a3ae5c4 |
|
MD5 | af01cb41f0225a81276f4582ba466c63 |
|
BLAKE2b-256 | 76e632e2414eae6f980a85f88429c12ef14a574c228ddaa40a4bfb089a9918a7 |