Skip to main content

pytest-pyeval

A pytest plugin integrating pydantic-evals

Run evals via pytest with the power of fixtures and using a familiar Arrange, Act, Evaluate pattern.

Example

from pyeval import dataset, execute, Case, EqualsExpected, Contains


def uppercase_text(text: str) -> str:
    return text.upper()


@dataset(
    Case(
        name="uppercase_basic",
        inputs="hello world",
        expected_output="HELLO WORLD",
    ),
    Case(
        name="uppercase_with_numbers",
        inputs="hello 123",
        expected_output="HELLO 123",
    ),
)
def eval_uppercase(case: Case):
    result = execute(uppercase_text, case)

    result.evaluate(EqualsExpected())
    result.evaluate(Contains(value="HELLO", case_sensitive=True))
$ uv run pyeval

============================== test session starts ==============================
platform darwin -- Python 3.13.1, pytest-9.0.2, pluggy-1.6.0
plugins: anyio-4.12.1, pyeval-0.1.0
collected 2 items

tests/evals/eval_example.py ●●                                                                         [100%]

============================= 2 evaluated in 0.02s ==============================

Installation

uv add --dev pytest-pyeval

Running evals

pytest-pyeval keeps evals separate from your regular test suite. Evals are excluded from pytest by default, since they are typically slower, hit live APIs, and run on a different cadence to unit tests.

Command What runs
pytest Regular tests only (test_*.py)
pytest --evals Eval tests only (eval_*.py)
pyeval Shorthand for pytest --evals
pyeval                     # discover and run all evals in the project
pyeval evals/              # run evals under a specific path
pyeval evals/eval_foo.py   # run a single eval file

Metadata

Release files for pytest-pyeval 0.4.0

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-pyeval 0.4.0
File Size Uploaded Provenance Actions
pytest_pyeval-0.4.0.tar.gz 7.2 kB Without provenance Details for pytest_pyeval-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pytest-pyeval 0.4.0
File Interpreter ABI Platform Actions
pytest_pyeval-0.4.0-py3-none-any.whl Python 3 none any Details for pytest_pyeval-0.4.0-py3-none-any.whl

Total release size: 16.1 kB

Release files / pytest_pyeval-0.4.0.tar.gz

Download URL pytest_pyeval-0.4.0.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
1dbed65d77e41a627723b9cf1d01518b436b41d48ea517fde0cf83ad0243b597
BLAKE2b-256 checksum
How to use checksums
ec8c4aee96c46dedbbffe3e4fc433fe8ce0f28d4536db93844f8daf0a92cce8e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / pytest_pyeval-0.4.0-py3-none-any.whl

Download URL pytest_pyeval-0.4.0-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
592b415ac95544fdab28d46f4be63c472931af212e2c5b40e26417cd7e77ba4b
BLAKE2b-256 checksum
How to use checksums
37c6a88727919988d8b9ad2f9d5ad3438832342e9bb3ad822d43d6aaa9bc3359
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for pytest-pyeval 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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