Skip to main content

Python test runner built in Rust

Project description

rtest

PyPI version Python License: MIT

A Python test runner built with Rust.

⚠️ Development Notice: rtest is in active development and not yet ready for production use. Expect bugs, incomplete features, and breaking changes as we work toward stability.

Features

Resilient Test Collection

Unlike pytest which stops execution when collection errors occur, rtest continues running tests even when some files fail to collect:

pytest stops everything when collection fails:

collected 22 items / 3 errors
!!!!!!!!!!!!!!!!!!!!! Interrupted: 3 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!
============================== 1 warning, 3 errors in 0.97s ==============================
# No tests run - you're stuck

rtest keeps going:

collected 22 items / 3 errors
!!!!!!!!!!!!!!!!!! Warning: 3 errors during collection !!!!!!!!!!!!!!!!!!!!!
================================== test session starts ===================================
# Your 22 working tests run while you fix the 3 broken files

Built-in Parallelization

rtest includes parallel test execution out of the box, without requiring additional plugins like pytest-xdist. Simply use the -n flag to run tests across multiple processes:

# Run tests in parallel (recommended for large test suites)
rtest -n 4                    # Use 4 processes
rtest -n auto                 # Auto-detect CPU cores
rtest --maxprocesses 8        # Limit maximum processes

Current Implementation

At the current moment, rtest delegates to pytest for test execution while providing enhanced collection and parallelization features.

Performance

rtest delivers significant performance improvements over pytest:

=== Full Test Execution Benchmark ===
Benchmark 1: pytest
  Time (mean ± σ):      3.990 s ±  0.059 s    [User: 3.039 s, System: 0.937 s]
  Range (min  max):    3.881 s   4.113 s    20 runs
 
Benchmark 2: rtest
  Time (mean ± σ):      65.9 ms ±  10.6 ms    [User: 22.9 ms, System: 22.8 ms]
  Range (min  max):    40.6 ms   78.7 ms    20 runs
 
Summary
  rtest ran
   60.52 ± 9.78 times faster than pytest

=== Test Collection Only Benchmark ===
Benchmark 1: pytest --collect-only
  Time (mean ± σ):      4.051 s ±  0.114 s    [User: 3.060 s, System: 0.959 s]
  Range (min  max):    3.961 s   4.424 s    20 runs
 
Benchmark 2: rtest --collect-only
  Time (mean ± σ):      40.7 ms ±  11.6 ms    [User: 16.6 ms, System: 12.8 ms]
  Range (min  max):    27.0 ms   80.8 ms    20 runs
 
Summary
  rtest --collect-only ran
   99.61 ± 28.52 times faster than pytest --collect-only

Performance benchmarks are a work-in-progress. These results are from a typical test suite using hyperfine with 20 runs each on MacBook Pro M4 Pro (48GB RAM). More comprehensive benchmarking is on the roadmap once additional features are implemented.

Quick Start

Installation

pip install rtest

Requires Python 3.9+

Basic Usage

# Drop-in replacement for [`pytest`](https://pytest.org)
rtest

# That's it! All your existing [`pytest`](https://pytest.org) workflows work
rtest tests/
rtest tests/test_auth.py -v
rtest -- -k "test_user" --tb=short

Advanced Usage

Environment Configuration

# Set environment variables for your tests
rtest -e DEBUG=1 -e DATABASE_URL=sqlite://test.db

# Perfect for testing different configurations
rtest -e ENVIRONMENT=staging -- tests/integration/

Collection and Discovery

# See what tests would run without executing them
rtest --collect-only

# Mix `rtest` options with any [`pytest`](https://pytest.org) arguments
rtest -n 4 -- -v --tb=short -k "not slow"

Python API

from rtest import run_tests

# Programmatic test execution
run_tests()

# With custom [`pytest`](https://pytest.org) arguments
run_tests(pytest_args=["tests/unit/", "-v", "--tb=short"])

# Perfect for CI/CD pipelines and automation
result = run_tests(pytest_args=["--junitxml=results.xml"])

Command Reference

Option Description
-n, --numprocesses N Run tests in N parallel processes
--maxprocesses N Maximum number of worker processes
-e, --env KEY=VALUE Set environment variables (can be repeated)
--dist MODE Distribution mode for parallel execution (default: load)
--collect-only Show what tests would run without executing them
--help Show all available options
--version Show rtest version

Pro tip: Use -- to separate rtest options from pytest arguments:

rtest -n 4 -e DEBUG=1 -- -v -k "integration" --tb=short

Contributing

We welcome contributions! Check out our Contributing Guide for details on:

  • Reporting bugs
  • Suggesting features
  • Development setup
  • Documentation improvements

License

MIT - see LICENSE file for details.


Acknowledgments

This project takes inspiration from Astral and leverages their excellent Rust crates:

Built with Rust for the Python community

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

rtest-0.0.3.tar.gz (765.5 kB view details)

Uploaded Source

Built Distributions

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

rtest-0.0.3-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ x86-64

rtest-0.0.3-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ x86-64

rtest-0.0.3-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

rtest-0.0.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

rtest-0.0.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

rtest-0.0.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

rtest-0.0.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

rtest-0.0.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

File details

Details for the file rtest-0.0.3.tar.gz.

File metadata

  • Download URL: rtest-0.0.3.tar.gz
  • Upload date:
  • Size: 765.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for rtest-0.0.3.tar.gz
Algorithm Hash digest
SHA256 6702dc261c16e96f708cdb1a6553f68a76d1acb786e8d1ca7904d7671cb6c0b6
MD5 d947d3eb06ac44e79c4fec439a7dc106
BLAKE2b-256 aecfaea8f68c6b344081034c0ff5c1063de849b583f5668b75d9ad0c9aa8720b

See more details on using hashes here.

File details

Details for the file rtest-0.0.3-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rtest-0.0.3-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f5e3f2eb247c7c50ee4ee468e1433f1818d090a07bf159d3c22de791404e8058
MD5 522e52ddb7d6a3d2f4469b20d4e823bd
BLAKE2b-256 110668911d7b32eef1e9abe517425b9ea1ab864ca2bf4ca363d1d8c602a0ac2d

See more details on using hashes here.

File details

Details for the file rtest-0.0.3-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rtest-0.0.3-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4356724c27b7896727412a2c05ef3196243b96d489c14c0995caced2d2c39b28
MD5 ecb38c985a8b08edaa7d284c98ddf4a2
BLAKE2b-256 fdfa49a0da8207bee9d374391852483f8f38745fc606652c435c1f784b053fc9

See more details on using hashes here.

File details

Details for the file rtest-0.0.3-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rtest-0.0.3-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7e4e2e1ce285ed42ccb8403e76e02d6d501f3b95a00b8d4258097403a7aefe37
MD5 6ac4aa6d08d7ed7626c90ee6696b278b
BLAKE2b-256 7bd8c463c2bc1d98623bde714d33dbbb7f97fdfa11783ce85a9bdf9f8627f990

See more details on using hashes here.

File details

Details for the file rtest-0.0.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rtest-0.0.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 701ef9a714b5049c68df4bd845d864fd891c432e6d744956364c38d98a07faff
MD5 79f6553c8fc865bb85d4986197311f6b
BLAKE2b-256 36c807a4c1b8c7a38c07c909af7645620deea3d8ab648e47a32eb68001e86d64

See more details on using hashes here.

File details

Details for the file rtest-0.0.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rtest-0.0.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c55df0b49697b94559d4d373131a58c49c70cecec13d66cadf243b850a7503ee
MD5 08fe9afdcb832d068959cc9090774391
BLAKE2b-256 dd58b70c256b8218c20485971c53c7d3d3bf2b5903bcfc2d6345e35d96b4d3e2

See more details on using hashes here.

File details

Details for the file rtest-0.0.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rtest-0.0.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 252cc31a2f46df09e50b6489c4738b88fd9493b5fb268d281ecabeebf887bccf
MD5 73922e7a141a15202d15209139559633
BLAKE2b-256 3372e34e4b5a59430918e0536b498b7d12525f686e9c6d6f26682e69ec6505b3

See more details on using hashes here.

File details

Details for the file rtest-0.0.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rtest-0.0.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5d98db80754b415d308804e70fd055be38f3f602f3810cff51f20fb7b2300bd0
MD5 64783244dc749bb89f4c5880bc5fa166
BLAKE2b-256 352ca276aadbc7c502149fe5781aa1fa0351a51baaa8bfc374e6dc49fe7a0656

See more details on using hashes here.

File details

Details for the file rtest-0.0.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rtest-0.0.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 84a2ead20e96953edc75b1580cd10607459ea2d48ab9986b547387db7c1247d8
MD5 62ca19cc6d1fc0a28383bb7e6a540a3c
BLAKE2b-256 85817d59caea586356d2586aceafcb278c8b8e28bcad7ee65650ffaab88c7036

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