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.1.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.1-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.1-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.1-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.1-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.1-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.1-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.1-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.1-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.1.tar.gz.

File metadata

  • Download URL: rtest-0.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 b6dc019a8d4ab7ad2f7a67018bbdf1be409ca8b735b3c7d5af4cb686e3fc2ce0
MD5 9f82c87bc134bc0070a80fc4cfcd279b
BLAKE2b-256 7148fe15a56c68a47809708e65dfd10346391137be4a7dae29d374155ea67b90

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rtest-0.0.1-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0cfa58d9f429937a6dfed8ab0741eb6332b8731b045c30de68e2d35eeeb64198
MD5 93e23e7e9a548a175d329f51feeab732
BLAKE2b-256 8098b26cdb7860e4589a6b24825c2dd38624f07e10ba665505a7bc5e2943897d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rtest-0.0.1-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 48cdde4621bb5219176c3c27dca3032260ecb35cb944948ffabe2bc50831b35b
MD5 d3d2819378b9f8343cde4f8124007207
BLAKE2b-256 10b530a8444e09d395ff2f54dcb32d513339c0bad734437512d98591d91656de

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rtest-0.0.1-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9f7a97f7ed38eb6646fc324ddedd78026c104fc71ef72143e33e3a200a0cf3ab
MD5 e639e77c0d19bd72788589944daf005f
BLAKE2b-256 d67abffe722ba0d4a46c1f375f959f08fdbacc4b23da91ba9559c6570f592cc6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rtest-0.0.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5e2711bbe205e5bb479b0ede74fc7312150cb089dd7905ea7491316f5fb73975
MD5 41cf5bff2ec90cddf249ca2b4039fc1f
BLAKE2b-256 db8760f22f242d9ae873633e96aca877b9d749de69c1bc25c6fe221e1096c6ac

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rtest-0.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e9e488ce0117dc0e8078fa84b6e6c18e2ed4e61fdba6be6c2de9c2e05b6d13c1
MD5 39e83eaeb4772738d8a15f963256fcdc
BLAKE2b-256 e37d1c2a87fe7a89688a50bae365d5c1609ae89ff5762606aab471afe84a71b6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rtest-0.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8d831172ae4f156611371501e141c01016b40fefb558119f5629a3e21da65555
MD5 56e462d32509ec00f97db7ceeb231983
BLAKE2b-256 348817440296b0d590d11f70b265d11688a84f728891572e30e8b7346306cfbf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rtest-0.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 444ce337c1d821cf00a4896a722ae719d41c27be41a0baf8e501380a2b0b757f
MD5 f10b8d31a4b5f1b50984e6ecbdc53280
BLAKE2b-256 ea2757cfb285ee871b8e600aabb24f8751bcca1bf764e7fa79889a08919c0969

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rtest-0.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fc415c77566a7feb2e80ec6434de4a77418dad857574961a3b3304d103e05034
MD5 1aac0374e2d1896bbd8e9c8d5a93d396
BLAKE2b-256 41df7eb7431df1e4c07742966d2932eeafcc90765d98364be27ffbb30cf4bc82

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