Skip to main content

A fast, drop-in compatible pytest runner written in Rust

Project description

pytest-rs

pytest-rs is a re-implementation of the popular Python testing framework pytest in Rust, focused on speed: a drop-in compatible runner where startup, collection, fixture orchestration, coverage measurement, and reporting are native code, while test bodies run on embedded CPython.

Note: This project is currently in active development (alpha stage). Many features are still under implementation and subject to change. See docs/DESIGN.md for the architecture and roadmap.

pytest-rs is an independent project, not affiliated with or endorsed by the pytest project.

Installation

Prebuilt wheels are published to PyPI for Linux (x86_64 / aarch64) and macOS (arm64) on CPython 3.13 / 3.14:

uv add --dev pytest-rs    # or: pip install pytest-rs

Then run your existing suite, no changes needed:

pytest-rs                       # whole suite, like `pytest`
pytest-rs tests/test_foo.py     # one file
pytest-rs -n 4                  # parallel workers (pytest-xdist compatible)
pytest-rs --cov=mypkg           # native coverage (pytest-cov compatible)

pytest-rs reads the same configuration pytest does (pytest.ini, pyproject.toml [tool.pytest.ini_options], tox.ini, setup.cfg) and understands the familiar flags (-v, -x, -k, -m, --lf, --tb=..., -p no:NAME, ...). It installs alongside pytest without conflict — the pytest command is untouched.

Requirements

  • Linux or macOS (no Windows support yet)
  • CPython 3.13+ built with a shared libpython — true for uv-managed Pythons, python.org installers, Homebrew, conda, and distro packages. Plain pyenv builds need PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install ....

Bundled plugins

The compatibility layers for pytest-asyncio, pytest-mock, pytest-cov, pytest-split, pytest-benchmark and pytest-xdist-style -n parallelism are built in — no separate plugin installs. Two ways to turn features off:

Per project or per run, like pytest (works with the prebuilt wheel):

[tool.pytest.ini_options]
addopts = "-p no:benchmark -p no:split"

At build time, when installing from source — bundled plugins are Cargo features, all enabled by default:

[tool.uv]
config-settings-package = { pytest-rs = { build-args = "--no-default-features --features asyncio,mock" } }

Performance

Native startup, collection, fixture orchestration, parallel workers (fork-based) and coverage measurement. Where it pays off:

  • suites with heavy fixture/parametrize orchestration and large collections
  • --cov runs (a native collector instead of a tracing hook)
  • -n parallel runs (fork workers instead of spawned interpreters)

For small, CPU-bound suites the test bodies dominate and pytest-rs runs at parity with pytest. Try it on your own suite:

hyperfine -w 1 'pytest -q' 'pytest-rs'

Known limitations

  • unix only (no Windows)
  • no --pdb / debugger integration yet
  • third-party pytest plugins are loaded via the pytest11 entry point and the pytest API shim; plugins reaching deep into pytest internals may not work

Conformance testing

Compatibility is verified by running the upstream test suites of the libraries pytest-rs reproduces, unchanged, under pytest-rs (conformance/).

Current results (total = passed + failed + errors + skipped; updated automatically by conformance/runner.py, refreshed by CI on every push to main — see conformance/RESULTS.md for per-file detail):

linux (CI-verified)

suite tag passed failed errors skipped total pass % files all-pass files run files excluded
pytest 9.0.3 1186 831 0 22 2039 58.2% 5 45 63
pytest-asyncio v1.4.0 262 0 1 0 263 99.6% 29 30 0
pytest-mock v3.15.1 85 0 0 5 90 94.4% 1 1 0
pytest-cov v7.1.0 105 101 0 3 209 50.2% 0 1 0
pytest-xdist v3.8.0 62 35 0 0 97 63.9% 0 1 6
pytest-split 0.9.0 59 0 0 0 59 100.0% 1 1 3
pytest-benchmark v5.1.0 40 82 0 1 123 32.5% 2 7 6

The suites are included as shallow git submodules under conformance/suites/ at the pinned release tags. Initialize them once after cloning:

git submodule update --init --depth 1

Then run the full conformance harness:

cargo build
uv run --no-project python conformance/runner.py --local   # uses submodules
uv run --no-project python conformance/runner.py           # re-clones from upstream (CI mode)
Project License Tag
pytest MIT 9.0.3
pytest-asyncio Apache-2.0 v1.4.0
pytest-mock MIT v3.15.1
pytest-cov MIT v7.1.0
pytest-xdist MIT v3.8.0
pytest-split MIT 0.9.0
pytest-benchmark BSD-2-Clause v5.1.0

pytest-rs reimplements the public APIs of these projects. Parts of the bundled Python shims are ports of upstream code; see THIRD-PARTY-NOTICES.md. Credit for the API design and the test suites belongs to their respective authors.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

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_rs-0.0.2.tar.gz (245.9 kB view details)

Uploaded Source

Built Distributions

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

pytest_rs-0.0.2-cp314-cp314-manylinux_2_28_x86_64.whl (3.0 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64

pytest_rs-0.0.2-cp314-cp314-manylinux_2_28_aarch64.whl (2.9 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ ARM64

pytest_rs-0.0.2-cp314-cp314-macosx_11_0_arm64.whl (2.8 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

pytest_rs-0.0.2-cp313-cp313-manylinux_2_28_x86_64.whl (3.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

pytest_rs-0.0.2-cp313-cp313-manylinux_2_28_aarch64.whl (2.9 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

pytest_rs-0.0.2-cp313-cp313-macosx_11_0_arm64.whl (2.8 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

File details

Details for the file pytest_rs-0.0.2.tar.gz.

File metadata

  • Download URL: pytest_rs-0.0.2.tar.gz
  • Upload date:
  • Size: 245.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pytest_rs-0.0.2.tar.gz
Algorithm Hash digest
SHA256 7aebe2bda4936fbcb2a1d81daa40ca29b8843c269c22afc985a5f6fb89b1b0b1
MD5 4bf7cf11cdb3a8ff3e81b6b057cfe8b0
BLAKE2b-256 423a480208e0b1f818b3434ac8b5f330eb9619d3391ec91040ba35d769566b1d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_rs-0.0.2.tar.gz:

Publisher: release.yml on Yasu-umi/pytest-rs

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_rs-0.0.2-cp314-cp314-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pytest_rs-0.0.2-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6e3fd0684574cab11d15a6b0126e2b97a5705626e85803c8d72e40c86c5cef3f
MD5 104eb16da0e9b64f62be77e7c7ff2d0e
BLAKE2b-256 3bd8f46d37b1af47235e2b73f7746e5c5d745c9d26c96d86026faf49f6fc8665

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_rs-0.0.2-cp314-cp314-manylinux_2_28_x86_64.whl:

Publisher: release.yml on Yasu-umi/pytest-rs

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_rs-0.0.2-cp314-cp314-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pytest_rs-0.0.2-cp314-cp314-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c0c29fe743045548aef7937e5a6021ff4026ed6d165cb1f0b55b75f2da1c60b5
MD5 19ebfebd8ffaa47dea4614fdc67f148b
BLAKE2b-256 727e5d21bd6a0ad60f6ae44d9ba75f0392f93beaba9c79039522dabe386d16f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_rs-0.0.2-cp314-cp314-manylinux_2_28_aarch64.whl:

Publisher: release.yml on Yasu-umi/pytest-rs

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_rs-0.0.2-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pytest_rs-0.0.2-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fead2d14cf7c103eae00d7ee9e838a89c2c0b5951012fc49da3f75bf18198b31
MD5 49e4df2c9a3d8246f3ed457b154accc2
BLAKE2b-256 3613c6ca84e566d9f3a251b42218e44257f9784d87337bb7c0a0196416c1e70e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_rs-0.0.2-cp314-cp314-macosx_11_0_arm64.whl:

Publisher: release.yml on Yasu-umi/pytest-rs

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_rs-0.0.2-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pytest_rs-0.0.2-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 74b1f9b7f5916ca116b9964672ea95765dec12cfe1813ef280c166f48ecec100
MD5 12756983004c9d4eb84c4d09b5e88d3a
BLAKE2b-256 dd1d6344303e15f6337ff085563d6cb262148c99377abbd108b543d420fbfb6d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_rs-0.0.2-cp313-cp313-manylinux_2_28_x86_64.whl:

Publisher: release.yml on Yasu-umi/pytest-rs

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_rs-0.0.2-cp313-cp313-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pytest_rs-0.0.2-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 5315946da570eb2b140c6e04aeb803d1849030e3e2fb9c48187efac7b18e3860
MD5 be62c93fe836c006634aa06bb9c79c7d
BLAKE2b-256 e7a49a0b0dc0f8851a4cfcb43644c2904564e1ad85636c16944aa5580afa6d76

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_rs-0.0.2-cp313-cp313-manylinux_2_28_aarch64.whl:

Publisher: release.yml on Yasu-umi/pytest-rs

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_rs-0.0.2-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pytest_rs-0.0.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dee67e341a0e37398112c328b9565a9cc884ef96f235826c6c903a4995f8dcaf
MD5 af98fe74ba70624d96dbe83986f63b94
BLAKE2b-256 cc408adca4f8035230f90f841bd997dce92bc14fec2ba53103c1d82eb739df40

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_rs-0.0.2-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: release.yml on Yasu-umi/pytest-rs

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 Pingdom Monitoring Sentry Error logging StatusPage Status page