Skip to main content

Record and play back your expectations

Project description

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

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_expected-0.1.1.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_expected-0.1.1-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

Details for the file pytest_expected-0.1.1.tar.gz.

File metadata

  • Download URL: pytest_expected-0.1.1.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.3

File hashes

Hashes for pytest_expected-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ab8529d2ab660c4ea5ed0897596e56dc15dada064af0df96b2047640186e9890
MD5 3c22b3066afcef4452b559bb5c8a6377
BLAKE2b-256 2c7616d36c5c0337000cd65c18ce46be2db8ca5745f5c2099b72dea2433ed8b2

See more details on using hashes here.

File details

Details for the file pytest_expected-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_expected-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 29cac09773ba5b259341d382ade8bf61ab8052408c8a440fdb4e9630a9632605
MD5 15c3ca62d7b2f88d3332618848b98cdc
BLAKE2b-256 0fb4e8bce23fc83431a05ff0bed6594ae5f450df625bca9f99a00ac23ce57a35

See more details on using hashes here.

Supported by

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