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 1182 835 0 22 2039 58.0% 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 47 159 0 3 209 22.5% 0 1 0
pytest-xdist v3.8.0 62 36 0 0 98 63.3% 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.1.tar.gz (237.0 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.1-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.1-cp314-cp314-manylinux_2_28_aarch64.whl (2.8 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.14macOS 11.0+ ARM64

pytest_rs-0.0.1-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.1-cp313-cp313-manylinux_2_28_aarch64.whl (2.8 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

pytest_rs-0.0.1-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.1.tar.gz.

File metadata

  • Download URL: pytest_rs-0.0.1.tar.gz
  • Upload date:
  • Size: 237.0 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.1.tar.gz
Algorithm Hash digest
SHA256 572c652f91e8bca8f2656b371ab6f68277b21e8cd4462b43883af264637f95d3
MD5 3d564328116105c53ebc62fa2af01889
BLAKE2b-256 4fa71ba71b22ba46048766a8ac8175e717528eae5a12b99568708098d8e837f8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_rs-0.0.1.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.1-cp314-cp314-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pytest_rs-0.0.1-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1c532d8cbf4c34f208e70cfb49d1281ab440482ae5a05c308012d364597375ea
MD5 655c94b44ed78e280bec70c417871214
BLAKE2b-256 7527c708baaf479afa2eb4d3a07e1010a8fc424863c3a05b06ec373aa6391f0d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_rs-0.0.1-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.1-cp314-cp314-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pytest_rs-0.0.1-cp314-cp314-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 f77ac663532125d3f5050c3b96b8b8f39036346c6d435874d05e378f14462382
MD5 896e941fd946cc8afddd01dc42659d4f
BLAKE2b-256 9dac1b3778fe22b0f37a592d4aa2ce4d0b78f5b553a10c01270927608d4951e7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_rs-0.0.1-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.1-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pytest_rs-0.0.1-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a2b1340f5305fcb1467b627dc254b02233dcb2c0397c99963f36ece6196730b3
MD5 325c8b9a3f93bebfe0c9b54eba0612fd
BLAKE2b-256 b69fddc39c7b11117ede079bb845b3b789962fa9167cddeeffce9403711950b2

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_rs-0.0.1-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.1-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pytest_rs-0.0.1-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3a632454ae052d15dfd50005de1f95dcb06d0f55aa6fb85ee58d493af92f99ae
MD5 5e7d8365c6f51b44f3803a5280aafb27
BLAKE2b-256 332280b109d19ad92811da5d26ba508d12928a58a9b6a7c00230b83208ecd5e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_rs-0.0.1-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.1-cp313-cp313-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pytest_rs-0.0.1-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 bf663d0f8ea53490d4ddee821683cfb4574d0a83c4b6c57775ab65e15f21073d
MD5 ac62744e912b135ee95f3342db596ea3
BLAKE2b-256 fbacfe2c863fe6046ddf1cbe3d85076c53ddf4ec4551d8ee0361011395af39ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_rs-0.0.1-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.1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pytest_rs-0.0.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8652176a2fcb63c54261235d256bbc135897ff1de9d0fa2b09949434673beb2f
MD5 568dd0dbc674ad68916732e4347890d9
BLAKE2b-256 a9c17c39d34af206ffdad29d6d63e025f2928c64f5614bd5e7cc948da8448530

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_rs-0.0.1-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