Skip to main content

A flexible and user-friendly snapshot testing plugin for pytest

Project description

pytest-insta

Build Status PyPI PyPI - Python Version Code style: black Checked with mypy

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest-insta-0.1.0.tar.gz (9.8 kB view hashes)

Uploaded Source

Built Distribution

pytest_insta-0.1.0-py3-none-any.whl (10.2 kB view hashes)

Uploaded Python 3

Supported by

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