pytest plugin integrating pydantic-evals
Project description
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
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pytest_pyeval-0.4.0.tar.gz.
File metadata
- Download URL: pytest_pyeval-0.4.0.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1dbed65d77e41a627723b9cf1d01518b436b41d48ea517fde0cf83ad0243b597
|
|
| MD5 |
77e892b04de5d6563f344eef873a9803
|
|
| BLAKE2b-256 |
ec8c4aee96c46dedbbffe3e4fc433fe8ce0f28d4536db93844f8daf0a92cce8e
|
File details
Details for the file pytest_pyeval-0.4.0-py3-none-any.whl.
File metadata
- Download URL: pytest_pyeval-0.4.0-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
592b415ac95544fdab28d46f4be63c472931af212e2c5b40e26417cd7e77ba4b
|
|
| MD5 |
17572bb9d6945022322d893ad2b62184
|
|
| BLAKE2b-256 |
37c6a88727919988d8b9ad2f9d5ad3438832342e9bb3ad822d43d6aaa9bc3359
|