Skip to main content

pytest-probatio

Use a probatio schema as a pytest assertion matcher. A schema reads as the expected shape, and a mismatch is explained by probatio's path-precise errors instead of a bare assert.

from pytest_probatio import Exact, Partial
from probatio import Port


def test_response(response):
    # Exact: extra keys make it unequal.
    assert response == Exact({"name": str, "port": Port()})

    # Partial: extra keys are allowed.
    assert response == Partial({"name": str})
    assert Exact({"name": str}) <= response

When the data does not match, the failure lists each error by its path:

data does not match the probatio schema (==):
  port: expected a port number between 1 and 65535

Install it alongside pytest; the plugin registers itself:

pip install pytest-probatio

This package lives in the probatio monorepo but ships separately, so the core probatio library stays dependency-free.

The full guide, including schema reuse across tests and the raises helper, lives at probatio.frenck.dev.

Download files

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

Source Distribution

pytest_probatio-0.11.1.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

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

pytest_probatio-0.11.1-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file pytest_probatio-0.11.1.tar.gz.

File metadata

  • Download URL: pytest_probatio-0.11.1.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pytest_probatio-0.11.1.tar.gz
Algorithm Hash digest
SHA256 af745ad9efa47ce4bb7d68e5d0e972fe6a764b2cd389894cfbfde8b339ab505d
MD5 c379f1d09252c95b9e0088586b0d8385
BLAKE2b-256 5030888c27abe79be8f24b30095bf0b2eb16ac9e89512bbbe6ec27faff540e35

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_probatio-0.11.1.tar.gz:

Publisher: release.yaml on frenck/probatio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytest_probatio-0.11.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_probatio-0.11.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b0978c3e518c16eb7e91278885a7b59fac9dc8809510181dd1f08f123cbfd97a
MD5 3a950f7d171b37382749adf58129211c
BLAKE2b-256 ff5e2de8c67b67e5d782d9767eeff9a96308166dd9febf5935a4b0235901cac9

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_probatio-0.11.1-py3-none-any.whl:

Publisher: release.yaml on frenck/probatio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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