Rustest is a Rust-powered pytest-compatible test runner delivering 8.5Γ average speedup with familiar pytest syntax and zero setup.
π Full Documentation | Getting Started | Migration Guide
Run your existing pytest tests with rustest β no code changes required:
pip install rustest
rustest --pytest-compat tests/See the speedup immediately, then migrate to native rustest for full features.
- π 8.5Γ average speedup over pytest (up to 19Γ on large suites)
- π§ͺ pytest-compatible β Run existing tests with
--pytest-compat - β
Familiar API β Same
@fixture,@parametrize,@markdecorators - π Built-in async & mocking β No pytest-asyncio or pytest-mock plugins needed
- π Clear error messages β Vitest-style output with Expected/Received diffs
- π Markdown testing β Test code blocks in documentation
- π οΈ Rich fixtures β
tmp_path,monkeypatch,mocker,capsys,caplog,cache, and more
Rustest delivers consistent speedups across test suites of all sizes:
| Test Count | pytest | rustest | Speedup |
|---|---|---|---|
| 20 | 0.45s | 0.12s | 3.8Γ |
| 500 | 1.21s | 0.15s | 8.3Γ |
| 5,000 | 7.81s | 0.40s | 19.4Γ |
Expected speedups: 3-4Γ for small suites, 5-8Γ for medium suites, 11-19Γ for large suites.
π Full Performance Analysis β
pip install rustest
# or
uv add rustestPython 3.10-3.14 supported. π Installation Guide β
Write a test in test_example.py:
from rustest import fixture, parametrize, mark, raises
@fixture
def numbers():
return [1, 2, 3, 4, 5]
def test_sum(numbers):
assert sum(numbers) == 15
@parametrize("value,expected", [(2, 4), (3, 9)])
def test_square(value, expected):
assert value ** 2 == expected
@mark.asyncio
async def test_async():
result = 42
assert result == 42
def test_exception():
with raises(ZeroDivisionError):
1 / 0Run your tests:
rustest # Run all tests
rustest tests/ # Run specific directory
rustest -k "test_sum" # Filter by name
rustest -m "slow" # Filter by mark
rustest --lf # Rerun last failed
rustest -x # Exit on first failure- Getting Started β Complete quickstart guide
- Migration from pytest β 5-minute migration guide
- User Guide β Fixtures, parametrization, marks, assertions
- API Reference β Complete API documentation
Contributions welcome! See the Development Guide for setup instructions.
MIT License. See LICENSE for details.