Skip to main content

pytest-expected

This pytest fixture lets you write tests that compare to a previously known, recorded value:

def test_something(expected):
    assert something(frobnicate=True) == expected

When called with --record, pytest will accept any value and store it in a file in the hidden .expected directory under the pytest root folder (usually the repository root).

When called without --record, it will load the known value(s) from that store, and assert that they are equal to the observed values.

Any picklable value can be stored.

You can also use expected several times in a test for different values, and it'll figure out the rest.

pytest-expected organizes storage based on:

  • Test ID (typically includes path to test file, test name, and parametrizations)
  • Number of uses of expected

Metadata

Release files for pytest-expected 0.1.1

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-expected 0.1.1
File Size Uploaded
pytest_expected-0.1.1.tar.gz 2.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-expected 0.1.1
File Interpreter ABI Platform
pytest_expected-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 5.6 kB

Release files / pytest_expected-0.1.1.tar.gz

Download URL pytest_expected-0.1.1.tar.gz
Size 2.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ab8529d2ab660c4ea5ed0897596e56dc15dada064af0df96b2047640186e9890
BLAKE2b-256 checksum
How to use checksums
2c7616d36c5c0337000cd65c18ce46be2db8ca5745f5c2099b72dea2433ed8b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.3

Release files / pytest_expected-0.1.1-py3-none-any.whl

Download URL pytest_expected-0.1.1-py3-none-any.whl
Size 2.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
29cac09773ba5b259341d382ade8bf61ab8052408c8a440fdb4e9630a9632605
BLAKE2b-256 checksum
How to use checksums
0fb4e8bce23fc83431a05ff0bed6594ae5f450df625bca9f99a00ac23ce57a35
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.3

Release history Release notifications | RSS feed

This release

0.1.1 This release

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