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.5.tar.gz (766.0 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.5-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.5-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.5-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.5-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.5-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.5-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.5-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.5-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.5.tar.gz.

File metadata

  • Download URL: rtest-0.0.5.tar.gz
  • Upload date:
  • Size: 766.0 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.5.tar.gz
Algorithm Hash digest
SHA256 9d9fea4ce7524a00dd90324201215d07824c2b1ed9a80b850860e969d81b604e
MD5 58e4ea86abb02b9a07533bb33d64dfb0
BLAKE2b-256 8d63c8398b9a16c8aa380b0a2b479f5f0d7348a7faa7eb0ae283c94a4bd904dc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rtest-0.0.5-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 068111b8e8037869e7d9e3c1257c84bb0404bba59aa7e318539e745f4b0d9550
MD5 5ce59743f1703a0f32af7cf7acce34d8
BLAKE2b-256 79ce0cdec22904bb20abc2815385a43a2832d668f67e085d208fbe8d438ecea9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rtest-0.0.5-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e5ff7a78347bae25a533772ac3f37b06a56313308921a7956f0a9d399e83b59c
MD5 5894c865a33608c5ea709b20e68109be
BLAKE2b-256 3a4090aa65fbcb0ef1b22370359d18b43607fce70dfc4f4acb1145f332ef0a9a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rtest-0.0.5-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5f3aadd1e9e291b72433dc7414e1cb140410bb4d1eac6d292657f90cc8cd7676
MD5 062448cd0c930aa0760b8b7b2d8d41ee
BLAKE2b-256 69999fc8ec636d69bd4cdf8c448dfa4116b5ad1575640719d07c88a3612412e2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rtest-0.0.5-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 347208ac029471aa75a711610e331c806f599d375dc82aedcd29ff485c075613
MD5 cabffa9a667e4490a910f11e3213524c
BLAKE2b-256 0c7f4ffefdcbf8cf7e8678b374c65026510438868a310fbefc039447e884e4cb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rtest-0.0.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4430c75a1fbedc8e4e210a6e2cae7b2f6e517499741454321432e9cb6dbadef7
MD5 76754ae1b8c88805b8349a2759498a29
BLAKE2b-256 b2864ff661b08f4f7893d1a1b67e0333b993d4896aae0a255c832353aba8ebc5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rtest-0.0.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 181e87c4cc21112ed5b33be6c33a9a14e42534ca352d1ad1cb2d6f5f22d878d5
MD5 d05465dd56ba18b2bd1242ec8c187af4
BLAKE2b-256 47a354b369d5437c926898c30a2b9d56d9dd0965b0f9ac669f64d8f5e5a6d36c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rtest-0.0.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ba20368c99626585e63813cabbf595d4e9acb1909a05c2bd5119eb9683f4d222
MD5 5b779396bbe620f7484b76ad3f7ab351
BLAKE2b-256 35bc3f68c7e4a52e7e2a5ffc2ef8955d3ade2fab809759e20ef5e8d37d00f422

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rtest-0.0.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dddee7a1ca4ff1f2dc62e42a845bcad3b520779b9cdfceb9ef843a9d5718e4c7
MD5 af39747f76bb0259ca5854b5f6e519df
BLAKE2b-256 ff7800b9e93e71be16d3a88c23fd50d157a3af3a9c0d3e2c756821546f1b6bf7

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