An open API service indexing awesome lists of open source software.

https://github.com/apex-engineers-inc/rustest

Pytest-style python test runner powered by Rust - built for speed ๐Ÿš€
https://github.com/apex-engineers-inc/rustest

python test testing unit-testing

Last synced: 7 months ago
JSON representation

Pytest-style python test runner powered by Rust - built for speed ๐Ÿš€

Awesome Lists containing this project

README

          

![rustest logo](assets/logo.svg)

Rustest is a Rust-powered pytest-compatible test runner delivering **8.5ร— average speedup** with familiar pytest syntax and zero setup.

๐Ÿ“š **[Full Documentation](https://apex-engineers-inc.github.io/rustest)** | [Getting Started](https://apex-engineers-inc.github.io/rustest/getting-started/quickstart/) | [Migration Guide](https://apex-engineers-inc.github.io/rustest/from-pytest/migration/)

## ๐Ÿš€ Try It Now

Run your existing pytest tests with rustest โ€” no code changes required:

```bash
pip install rustest
rustest --pytest-compat tests/
```

See the speedup immediately, then migrate to native rustest for full features.

## Why Rustest?

- ๐Ÿš€ **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`, `@mark` decorators
- ๐Ÿ”„ **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

## Performance

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 โ†’](https://apex-engineers-inc.github.io/rustest/advanced/performance/)**

## Installation

```bash
pip install rustest
# or
uv add rustest
```

**Python 3.10-3.14 supported.** [๐Ÿ“– Installation Guide โ†’](https://apex-engineers-inc.github.io/rustest/getting-started/installation/)

## Quick Start

Write a test in `test_example.py`:

```python
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 / 0
```

Run your tests:

```bash
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
```

**[๐Ÿ“– Full Documentation โ†’](https://apex-engineers-inc.github.io/rustest)**

## Learn More

- **[Getting Started](https://apex-engineers-inc.github.io/rustest/getting-started/quickstart/)** โ€” Complete quickstart guide
- **[Migration from pytest](https://apex-engineers-inc.github.io/rustest/from-pytest/migration/)** โ€” 5-minute migration guide
- **[User Guide](https://apex-engineers-inc.github.io/rustest/guide/writing-tests/)** โ€” Fixtures, parametrization, marks, assertions
- **[API Reference](https://apex-engineers-inc.github.io/rustest/api/overview/)** โ€” Complete API documentation

## Contributing

Contributions welcome! See the [Development Guide](https://apex-engineers-inc.github.io/rustest/advanced/development/) for setup instructions.

## License

MIT License. See [LICENSE](LICENSE) for details.