Skip to main content

Rust powered pytest-compatible runner

Project description

rustest

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 ~2x faster test execution with familiar syntax and minimal setup.

📚 Full Documentation | Getting Started | User Guide | API Reference

Why rustest?

  • 🚀 About 2x faster than pytest on the rustest integration test suite
  • ✅ Familiar @fixture, @parametrize, @skip, and @mark decorators
  • 🔄 Built-in async support with @mark.asyncio (like pytest-asyncio)
  • 🔍 Automatic test discovery (test_*.py and *_test.py files)
  • 📝 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. Our latest benchmarks on the rustest integration suite (~200 tests) show a consistent 2.1x wall-clock speedup over pytest:

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

📖 Installation Guide →

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

📖 Full Quick Start Guide →

Documentation

📚 Full Documentation

Getting Started

User Guide

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rustest-0.7.0.tar.gz (211.4 kB view details)

Uploaded Source

Built Distributions

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

rustest-0.7.0-cp313-cp313-win_amd64.whl (640.7 kB view details)

Uploaded CPython 3.13Windows x86-64

rustest-0.7.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (801.0 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

rustest-0.7.0-cp313-cp313-macosx_11_0_arm64.whl (722.0 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

rustest-0.7.0-cp313-cp313-macosx_10_12_x86_64.whl (766.6 kB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

rustest-0.7.0-cp312-cp312-win_amd64.whl (640.7 kB view details)

Uploaded CPython 3.12Windows x86-64

rustest-0.7.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (801.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

rustest-0.7.0-cp312-cp312-macosx_11_0_arm64.whl (722.1 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

rustest-0.7.0-cp312-cp312-macosx_10_12_x86_64.whl (766.6 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

rustest-0.7.0-cp311-cp311-win_amd64.whl (642.0 kB view details)

Uploaded CPython 3.11Windows x86-64

rustest-0.7.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (802.0 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

rustest-0.7.0-cp311-cp311-macosx_11_0_arm64.whl (723.2 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

rustest-0.7.0-cp311-cp311-macosx_10_12_x86_64.whl (768.7 kB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

rustest-0.7.0-cp310-cp310-win_amd64.whl (642.3 kB view details)

Uploaded CPython 3.10Windows x86-64

rustest-0.7.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (802.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

rustest-0.7.0-cp310-cp310-macosx_11_0_arm64.whl (723.7 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

rustest-0.7.0-cp310-cp310-macosx_10_12_x86_64.whl (768.7 kB view details)

Uploaded CPython 3.10macOS 10.12+ x86-64

File details

Details for the file rustest-0.7.0.tar.gz.

File metadata

  • Download URL: rustest-0.7.0.tar.gz
  • Upload date:
  • Size: 211.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.8

File hashes

Hashes for rustest-0.7.0.tar.gz
Algorithm Hash digest
SHA256 6a289d455d8e6e847c3d64a85e4008d427297d41323ec79d0cabc8f2f03212db
MD5 ad0848962ef634d44a70de276bd80dfa
BLAKE2b-256 1fc0a246292b78b880be5b3f538db3eec8d3d8c431f8cc4436189b66947ffa19

See more details on using hashes here.

File details

Details for the file rustest-0.7.0-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for rustest-0.7.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 acc96b340564f1de7b0e0fefc9b661de85d9bc0f6d27092c76f1296ec91419d4
MD5 6002bac2132ae98cd6f6b342d763f22c
BLAKE2b-256 728e13a498809e5dc010dec069637d5dcb78669034e57dd991b355bf53405364

See more details on using hashes here.

File details

Details for the file rustest-0.7.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rustest-0.7.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f707e06ca21a74ccb075c5c55b765c5cf66f20cce8777c9017da5e7a3c2ec4ff
MD5 80335c10180f5c72715adebbdaa6b373
BLAKE2b-256 b16ae4d779eca88136c6f4268fc28dea09e71b5a2c471e187cef287bc82690b0

See more details on using hashes here.

File details

Details for the file rustest-0.7.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustest-0.7.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 08ecd23ecc069d31598ffa8c1d09c8c547d96b56577fbb190efd89dfca88340b
MD5 cb5ddab11f465772961a08e54d60daba
BLAKE2b-256 f36a6fbfae8062a552ed3053f89d84edfcb9fa0643b01661dc2e214f58ccaec5

See more details on using hashes here.

File details

Details for the file rustest-0.7.0-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for rustest-0.7.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 52939b21227e606426a8576b538978fed2ed8372972afce4b80c01a92e4146b5
MD5 7c16a417bc99428bc167cc78a1f9cf89
BLAKE2b-256 829bba0f4e66dde326783139862944ad66386fb81ac0d422a8d4ed8df16238e8

See more details on using hashes here.

File details

Details for the file rustest-0.7.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for rustest-0.7.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 20de8171332de06571ba3c01bd651b887551b96ab1927d4c698caaf28aeb2fb7
MD5 fa89c6c689a8ad0cc7184bfd16c382fd
BLAKE2b-256 0b031195a920413bedc4208b07d75374351b6bf6fc5498addf2a054fccf0d4f2

See more details on using hashes here.

File details

Details for the file rustest-0.7.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rustest-0.7.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 aff9bda311976469cd9ec8daa6eaa293040842b601ece3737f5a51bf54e4c77e
MD5 b0e4faa5ba4518968c6718dae358b2bd
BLAKE2b-256 b6bc9b7266dd40f79e4e8f7c66b56f8e5a1385dfbb16792ea56fa6de87dec39b

See more details on using hashes here.

File details

Details for the file rustest-0.7.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustest-0.7.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8c1260754c3ef6df86ceb1c4cc5e1db3c9cd3d304e7ed1db59e93d85bf0dcd9c
MD5 aec8177fa72d97cb1dfefb21ffdbb34f
BLAKE2b-256 69c9ecee2ba971a5ae9474993ebc41da13bd755fab8ce3e71a48b945d0b4563d

See more details on using hashes here.

File details

Details for the file rustest-0.7.0-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for rustest-0.7.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 96872f69a4a3082c05caf2d7d070434502fb797ba21b261470441048ecda4fd5
MD5 223df221ba8890b6530198210cb3ce7d
BLAKE2b-256 c41171253ad471dcfdff8b91afdba8ae7d7e6ae8e068938e0eac395ec0031be8

See more details on using hashes here.

File details

Details for the file rustest-0.7.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for rustest-0.7.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 6b3767081f5e2537612ccd32a0c177bb18e223e955c8dfea29dd1eae9d1de856
MD5 92f9d38df2e9a2bdce47359c4f5d32e6
BLAKE2b-256 d807f885137c78791c5b95ec21755b14d2af8633f72fc064ae07ee4dfde9ee7b

See more details on using hashes here.

File details

Details for the file rustest-0.7.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rustest-0.7.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 013f59687a74b56d0020b12916fb77ec90be5b07feb988a1a312e3c3d3d50151
MD5 932b65e0233e4db9d05824026b5949bf
BLAKE2b-256 b9b41d2cf48aa84b8eadf0bd33b36f70e1ca84f4b06c852e6d882f21a0b54279

See more details on using hashes here.

File details

Details for the file rustest-0.7.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustest-0.7.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a2d0f09c90befbd086964d3868b5c323b46cc0115f62024acb0a3ae1e57bd16e
MD5 b4cfe4c4c9db64f6a339b4974868757f
BLAKE2b-256 21c3db754ad015800170df8686b0d09716635e705e63c2bbcbeba3d46771a77c

See more details on using hashes here.

File details

Details for the file rustest-0.7.0-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for rustest-0.7.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 dabfda35b24f057625a91bd646438a4aededac2b919777c4b3fe21c7744e1b56
MD5 3a1bd1699fcf22dd6f8be1c694e6fb17
BLAKE2b-256 3b6815d1305627f9dca290db187dc65894fbdc062bbd6a21ac98cf7dcb1ac5dd

See more details on using hashes here.

File details

Details for the file rustest-0.7.0-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for rustest-0.7.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 73e79243b17f7adad9d13f30d78a8f9d7d538e123efcd4f5dedc11bdc243314f
MD5 edf819255c20c6d34d046a80ee543392
BLAKE2b-256 0f62dd0acd35e8113fea5da26e425b34b78fbc68f254079a7e9d6edb0e7c6a42

See more details on using hashes here.

File details

Details for the file rustest-0.7.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rustest-0.7.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 542259a46a9ad10e028208e0af54f2cc033c5bef4a05a06bd51cfa8603d568e0
MD5 e9b8af78d3c609bc08984940b643768e
BLAKE2b-256 8a4d41e6be27eefb9a5ee76cd754b093ecb7eb0ac7b885dc8a27ed3a87c5d23d

See more details on using hashes here.

File details

Details for the file rustest-0.7.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustest-0.7.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7b29cf03ede1bd5fe73332e2960cc3454b8c8d5bf6ed85196f5cf23a5bff9038
MD5 322943ecff20096ecbae21406e888623
BLAKE2b-256 8bb8f73aedaec38c447ea7fb8ce650121af183d00764c4c1269fbde3297e95c6

See more details on using hashes here.

File details

Details for the file rustest-0.7.0-cp310-cp310-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for rustest-0.7.0-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 0088fa41ad4e04285e8d28179b7996348a601ca56aa076c7fcb148f8b809d23d
MD5 59b3b6a08269070a89dead88022b991e
BLAKE2b-256 2a38b88a074ed4b74771dde325d48865faf5fb88aa877ac852899f830b3811c1

See more details on using hashes here.

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