Rust powered pytest-compatible runner
Project description
Rustest (pronounced like Russ-Test) is a Rust-powered test runner that aims to provide the most common pytest ergonomics with a focus on raw performance. Get massive speedups (8.5× average, up to 19× faster) with familiar syntax and minimal setup.
📚 Full Documentation | Getting Started | User Guide | API Reference
Why rustest?
- 🚀 8.5× average speedup over pytest on the synthetic benchmark matrix (peaking at 19× on 5k-test suites)
- ✅ Familiar
@fixture,@parametrize,@skip, and@markdecorators - 🔄 Built-in async support with
@mark.asyncio(like pytest-asyncio) - 🔍 Automatic test discovery (
test_*.pyand*_test.pyfiles) - 📝 Built-in markdown code block testing (like pytest-codeblocks, but faster)
- 🎯 Simple, clean API—if you know pytest, you already know rustest
- 🧮 Built-in
approx()helper for tolerant numeric comparisons - 🪤
raises()context manager for precise exception assertions - 📦 Easy installation with pip or uv
- ⚡ Low-overhead execution keeps small suites feeling instant
Performance
Rustest is designed for speed. The new benchmark matrix generates identical pytest and rustest suites ranging from 1 to 5,000 tests and runs each command five times. Rustest delivers an 8.5× average speedup and reaches 19× faster execution on the largest suite:
| Test Count | pytest (mean) | rustest (mean) | Speedup | pytest tests/s | rustest tests/s |
|---|---|---|---|---|---|
| 1 | 0.428s | 0.116s | 3.68x | 2.3 | 8.6 |
| 5 | 0.428s | 0.120s | 3.56x | 11.7 | 41.6 |
| 20 | 0.451s | 0.116s | 3.88x | 44.3 | 171.7 |
| 100 | 0.656s | 0.133s | 4.93x | 152.4 | 751.1 |
| 500 | 1.206s | 0.146s | 8.29x | 414.4 | 3436.1 |
| 1,000 | 1.854s | 0.171s | 10.83x | 539.4 | 5839.4 |
| 2,000 | 3.343s | 0.243s | 13.74x | 598.3 | 8219.9 |
| 5,000 | 7.811s | 0.403s | 19.37x | 640.2 | 12399.7 |
What speedup should you expect?
- Tiny suites (≤20 tests): Expect ~3–4× faster runs. Startup costs dominate here, so both runners feel instant, but rustest still trims a few hundred milliseconds on every run.
- Growing suites (≈100–500 tests): Expect ~5–8× faster execution. Once you have a few dozen files, rustest's lean discovery and fixture orchestration start to compound.
- Large suites (≥1,000 tests): Expect ~11–19× faster runs. Bigger suites amortize startup overhead entirely, letting rustest's Rust core stretch its legs and deliver order-of-magnitude gains.
Highlights:
- 8.5× average speedup across the matrix (geometric mean 7.0×)
- 16.2× weighted speedup when weighting by the number of executed tests
- 1.45s total runtime for rustest vs 16.18s for pytest across all suites
Reproduce the matrix locally:
python3 profile_tests.py --runs 5
python3 generate_comparison.py
Real-world integration suite (~200 tests)
Our integration suite remains a great proxy for day-to-day use and still shows a ~2.1× wall-clock speedup:
| Test Runner | Wall Clock | Speedup | Command |
|---|---|---|---|
| pytest | 1.33–1.59s | 1.0x (baseline) | pytest tests/ examples/tests/ -q |
| rustest | 0.69–0.70s | ~2.1x faster | python -m rustest tests/ examples/tests/ |
Large parametrized stress test
With 10,000 parametrized invocations:
| Test Runner | Avg. Wall Clock | Speedup | Command |
|---|---|---|---|
| pytest | 9.72s | 1.0x | pytest benchmarks/test_large_parametrize.py -q |
| rustest | 0.41s | ~24x faster | python -m rustest benchmarks/test_large_parametrize.py |
📊 View Detailed Performance Analysis →
Installation
Rustest supports Python 3.10 through 3.14.
# Using pip
pip install rustest
# Using uv
uv add rustest
Quick Start
1. Write Your Tests
Create a file test_math.py:
from rustest import fixture, parametrize, mark, approx, raises
import asyncio
@fixture
def numbers() -> list[int]:
return [1, 2, 3, 4, 5]
def test_sum(numbers: list[int]) -> None:
assert sum(numbers) == approx(15)
@parametrize("value,expected", [(2, 4), (3, 9), (4, 16)])
def test_square(value: int, expected: int) -> None:
assert value ** 2 == expected
@mark.slow
def test_expensive_operation() -> None:
result = sum(range(1000000))
assert result > 0
@mark.asyncio
async def test_async_operation() -> None:
# Example async operation
await asyncio.sleep(0.001)
result = 42
assert result == 42
def test_division_by_zero() -> None:
with raises(ZeroDivisionError, match="division by zero"):
1 / 0
2. Run Your Tests
# Run all tests
rustest
# Run specific tests
rustest tests/
# Filter by test name pattern
rustest -k "test_sum"
# Filter by marks
rustest -m "slow" # Run only slow tests
rustest -m "not slow" # Skip slow tests
rustest -m "slow and integration" # Run tests with both marks
# Rerun only failed tests
rustest --lf # Last failed only
rustest --ff # Failed first, then all others
# Exit on first failure
rustest -x # Fail fast
# Combine options
rustest --ff -x # Run failed tests first, stop on first failure
# Show output during execution
rustest --no-capture
Documentation
Getting Started
User Guide
- Writing Tests
- Fixtures
- Parametrization
- Marks & Skipping
- Test Classes
- Assertion Helpers
- Markdown Testing
- CLI Usage
- Python API
API Reference
Advanced Topics
Feature Comparison with pytest
Rustest implements the 20% of pytest features that cover 80% of use cases, with a focus on raw speed and simplicity.
📋 View Full Feature Comparison →
✅ Supported: Fixtures, parametrization, marks, test classes, conftest.py, markdown testing 🚧 Planned: Parallel execution, mark filtering, JUnit XML output ❌ Not Planned: Plugins, hooks, custom collectors (keeps rustest simple)
Contributing
We welcome contributions! See the Development Guide for setup instructions.
Quick reference:
# Setup
git clone https://github.com/Apex-Engineers-Inc/rustest.git
cd rustest
uv sync --all-extras
uv run maturin develop
# Run tests
uv run poe pytests # Python tests
cargo test # Rust tests
# Format and lint
uv run pre-commit install # One-time setup
git commit -m "message" # Pre-commit hooks run automatically
License
rustest is distributed under the terms of the MIT license. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
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 rustest-0.8.0.tar.gz.
File metadata
- Download URL: rustest-0.8.0.tar.gz
- Upload date:
- Size: 230.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81ae2aea5e59f232cb5e9d9ea4006fd0d64289fb402f75fc5a3128efa4be44d2
|
|
| MD5 |
27cfc2d8d6f9cec784fe83f184742da9
|
|
| BLAKE2b-256 |
36b610c00ddf186d1c2448473f8354fdac2553b1a340eee74aab0f8805a2d43e
|
File details
Details for the file rustest-0.8.0-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: rustest-0.8.0-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 646.1 kB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4cab20177507269b308a228cd4b721f7ce1f7a0a6629975aea3514f01fc42b7d
|
|
| MD5 |
980662db6ed4bcca74fed70cc4e43bc6
|
|
| BLAKE2b-256 |
a1a15c00fb75da2b76a85d5019a9af6bcee1e3c7ec8df3acc219bc0352aee8fc
|
File details
Details for the file rustest-0.8.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: rustest-0.8.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 806.1 kB
- Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c12cd2751497c5835318fb0e2e36f176f66325743a5c730e7b01503cb5133c6
|
|
| MD5 |
a30335d3f4fbee51c46c524c7f1e3df4
|
|
| BLAKE2b-256 |
f8fe94fde7b60ac7f940f6c6bd450aea94e6ac904eb4198e2700e13fbfea9210
|
File details
Details for the file rustest-0.8.0-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: rustest-0.8.0-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 728.4 kB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dacf82a87070b2b0122fef39d3c29c65fda5e4ae5d902060c3402ae216b55207
|
|
| MD5 |
b1f8a8d5e711714e6a5e519ee7977ebc
|
|
| BLAKE2b-256 |
16f6bc31fdcc0c59f04e361699bcd1b685888df0abfb1d8fea98744fc1940fdf
|
File details
Details for the file rustest-0.8.0-cp313-cp313-macosx_10_12_x86_64.whl.
File metadata
- Download URL: rustest-0.8.0-cp313-cp313-macosx_10_12_x86_64.whl
- Upload date:
- Size: 772.5 kB
- Tags: CPython 3.13, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f1838b4c68b204d428c11ccd36da300f7c9d9224efb3fcd8cab11b342f875cb
|
|
| MD5 |
8acdad8f2f65f04957d747b98f42af54
|
|
| BLAKE2b-256 |
c4115e777021658a31c260018ceec782ddde8c64597b7847aaa22df28a2f2421
|
File details
Details for the file rustest-0.8.0-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: rustest-0.8.0-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 646.3 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
33cb1c75b6e45c7b7e25c454dfabd4ed5ddf6c579f07b43708e18941757fd40d
|
|
| MD5 |
aa876932468e9d1e4691903a26aeb16d
|
|
| BLAKE2b-256 |
caa1b48d0ef8e9df11c2060e3913b4db756243a47492665bc459c6d89fa85bcf
|
File details
Details for the file rustest-0.8.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: rustest-0.8.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 806.0 kB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0dc9ff3f572d238ff9b5369120025877e9a1ecdcfa73d17bb6adbd11da23b4e4
|
|
| MD5 |
6beb23041f7fc1e5cf0c632f4b02dd62
|
|
| BLAKE2b-256 |
2c0a0d8a0a16ef7d7c3816b4e466242307b6dc06c102a62d4e1dfca4d90112a6
|
File details
Details for the file rustest-0.8.0-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: rustest-0.8.0-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 728.6 kB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a87963f0f5c576e1968a64d98f002436e552299677dafb41c4d2c5c8161e3a5
|
|
| MD5 |
3f91aaa198897e1584872ac52292768e
|
|
| BLAKE2b-256 |
b81f891dc65bd65e80a0d7a5b8ee7698f1b26bebbdd4ea915c4cccc77c72ef2c
|
File details
Details for the file rustest-0.8.0-cp312-cp312-macosx_10_12_x86_64.whl.
File metadata
- Download URL: rustest-0.8.0-cp312-cp312-macosx_10_12_x86_64.whl
- Upload date:
- Size: 772.6 kB
- Tags: CPython 3.12, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
23d1c368c0f24b50135cc733aa196e0eec9b70eecdb32ab1f37f6bdee2ebac42
|
|
| MD5 |
4b97ddb2aeb92d50fd5318177c245ff6
|
|
| BLAKE2b-256 |
f8e1328eb60d154a30bdd1789d55a5cc3846d1f54715f45a1b224a50d56a83cb
|
File details
Details for the file rustest-0.8.0-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: rustest-0.8.0-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 648.1 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d922048bd4f3ec5fa8d8ccbb89d0b870974ba1f729aaf6129153a0a686cae31
|
|
| MD5 |
58f141af84bd4068af3b765167d84890
|
|
| BLAKE2b-256 |
6106e569735974c3d8e796cf92e1c9044f18d84773b921d15a15c7bad2ccd5d1
|
File details
Details for the file rustest-0.8.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: rustest-0.8.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 807.2 kB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7b81ea481e98ffdbf5886b3f9423f2abad42193e18180967a129cf51b13f2b4
|
|
| MD5 |
1aac8e4fb042ca4e33c500a4bfe7d174
|
|
| BLAKE2b-256 |
fe1634ca9b783f63f3f43e3c2b62781e787e25e40b944c818de848cc06cbc18d
|
File details
Details for the file rustest-0.8.0-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: rustest-0.8.0-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 729.5 kB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
811b320a29adb43d8f6836c8f858a1d8e5d3349751d1a5f69487ef2df2c7b904
|
|
| MD5 |
41c029c56414a36ea6548fae5937dabb
|
|
| BLAKE2b-256 |
0bbf136265daee60d4ae220632055fc5b149b00bb3e40e32467babae6cd16a9b
|
File details
Details for the file rustest-0.8.0-cp311-cp311-macosx_10_12_x86_64.whl.
File metadata
- Download URL: rustest-0.8.0-cp311-cp311-macosx_10_12_x86_64.whl
- Upload date:
- Size: 774.9 kB
- Tags: CPython 3.11, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2252c3ac50a636170c114898c4f5dc66369c329c89278c8cd38e9243c86bf603
|
|
| MD5 |
5889a72cefeb6881b72da919ff5776bf
|
|
| BLAKE2b-256 |
282bba8b3fa6284795539b3bc611a1537ebe464431b4b6dfb02565ae2583f674
|
File details
Details for the file rustest-0.8.0-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: rustest-0.8.0-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 648.3 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
401c0c4146cd8ac1998739438e1bc5daf9935f58da04deca3472d46b75a9b2ce
|
|
| MD5 |
626965f0e2efb7986e506e60b5843acc
|
|
| BLAKE2b-256 |
2a331caf54e4863a726d3da1752f927dafa7f616d79ee870d0c94599a4e540fe
|
File details
Details for the file rustest-0.8.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: rustest-0.8.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 807.3 kB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07d6983a90153954f5d57cfdd8979a405e66d356421a0a0ff2f3d0ba67598fa9
|
|
| MD5 |
fbb74e938143ea0d0afbcc33e42522fa
|
|
| BLAKE2b-256 |
8213ef9e6d12b1a8432b705a171d7e70fdb6074068f664bb2fac973f65536cc0
|
File details
Details for the file rustest-0.8.0-cp310-cp310-macosx_11_0_arm64.whl.
File metadata
- Download URL: rustest-0.8.0-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 730.0 kB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6681aefdcfa88953a4086247e40d66b05c9c8611c9d315e0a599844926444aa6
|
|
| MD5 |
7878bfff3d7c52cdce00882fcf3710a8
|
|
| BLAKE2b-256 |
53d6214b332f7dbc6dc7d197939fbbf778845e618ace165ce91b863029a5f905
|
File details
Details for the file rustest-0.8.0-cp310-cp310-macosx_10_12_x86_64.whl.
File metadata
- Download URL: rustest-0.8.0-cp310-cp310-macosx_10_12_x86_64.whl
- Upload date:
- Size: 775.1 kB
- Tags: CPython 3.10, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
015d9b243322e0a44122f54141aa588ed626f569d8308033b206b1255ed311d3
|
|
| MD5 |
0089f2cb468af7d1cb149c717c8b793c
|
|
| BLAKE2b-256 |
1aa9e89090290cdcd7da13578a3a14aa3d76f433eb0b11fad9e4554b138bb432
|