Skip to main content
PyPI version https://img.shields.io/pypi/l/pytest-goldie.svg

pytest-goldie is a pytest plugin that enables golden testing using pytest framework. Golden testing is a methodology that compares the output of your code with a pre-recorded output. This package provides a fixture called golden that can be used to update test results and make test comparisons.

Example

First, install the plugin:

$ pip install pytest-goldie

Then, in your test file, use the golden fixture:

def my_function():
    return "Hello, world!"

def test_my_function(golden):
    output = my_function()
    golden.test(output)

The golden.test method takes the output of your function and compares it to the saved output of a previous run. If the update_goldens flag is set, pytest-goldie will update the saved output with the new output.

To run the tests and update goldens, use the following command:

$ pytest --update_goldens

By default, the golden files are stored in a folder named ‘goldens’. You can change the folder name with –goldens_folder flag:

$ pytest --goldens_folder my_goldens

This will set the goldens folder to “my_goldens” instead of the default “goldens”.

License

This software is licensed under the MIT License.

Created by Nick Kartashov and contributors.

Metadata

Release files for pytest-goldie 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-goldie 0.1.5
File Size Uploaded
pytest-goldie-0.1.5.tar.gz 4.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-goldie 0.1.5
File Interpreter ABI Platform
pytest_goldie-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 8.9 kB

Release files / pytest-goldie-0.1.5.tar.gz

Download URL pytest-goldie-0.1.5.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
8aa3dc1dc282d66b5f4a09fd04ad0227e8b292f73585cc8393a58c9e8b602dc3
BLAKE2b-256 checksum
How to use checksums
5c959ca5ddc92cf71c18a6e05fc877f67ec79bc8461f13b2dfaab44a37985dca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.12

Release files / pytest_goldie-0.1.5-py3-none-any.whl

Download URL pytest_goldie-0.1.5-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a7fc8c202733f2d0df1efbc6a7e7fc02645b009cd8354cbe4d97e3f8f7bb82b3
BLAKE2b-256 checksum
How to use checksums
0f5dab49825a8dcca065edcc04e078a6caf6786a5b6fd4126023c37d4f836c9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.12

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page