{"id":3264,"library":"rtest","title":"Rtest: Python test runner built in Rust","description":"Rtest is a high-performance Python test runner built in Rust. It replaces traditional import-heavy test collection with static Abstract Syntax Tree (AST) analysis, significantly speeding up test discovery, especially in large monorepos. Currently in early development (v0.0.x), it aims for `pytest` compatibility while offering performance gains and parallel test execution.","status":"active","version":"0.0.46","language":"en","source_language":"en","source_url":"https://github.com/hughhan1/rtest.git","tags":["test runner","rust","performance","pytest-compatible","testing"],"install":[{"cmd":"pip install rtest","lang":"bash","label":"Install rtest"}],"dependencies":[{"reason":"Requires Python 3.10 or newer.","package":"python","optional":false}],"imports":[{"note":"Rtest is primarily a command-line test runner. While it provides utility functions like `rtest.raises()`, the core interaction is via the `rtest` command.","symbol":"rtest command-line tool","correct":"rtest [options] [path...]"}],"quickstart":{"code":"# my_tests/test_example.py\ndef test_addition():\n    assert 1 + 1 == 2\n\ndef test_failing_example():\n    assert 'hello'.upper() == 'HELLO'\n\n# To run these tests from your terminal:\n# Navigate to your project root (e.g., one level above my_tests)\n# $ pip install rtest\n# $ rtest my_tests\n\n# Example with a specific rtest utility:\n# from rtest import raises\n#\n# def test_raises_exception():\n#     with raises(ValueError, match='invalid literal'):\n#         int('abc')","lang":"python","description":"Create a test file (e.g., `my_tests/test_example.py`) with standard Python test functions. Run `rtest` from your terminal, pointing it to your test directory or files. Rtest will discover and execute the tests."},"warnings":[{"fix":"Refer to the GitHub changelog for specific version updates and breaking changes. Pinning versions and testing upgrades is recommended.","message":"Rtest is in early development (v0.0.x); expect frequent bugs, breaking changes, and evolving features as it progresses towards stability.","severity":"breaking","affected_versions":"All versions < 1.0.0"},{"fix":"Be aware of platform differences when parsing or comparing test nodeids in CI/CD pipelines or custom reporting tools.","message":"Path Separator Differences: Rtest uses platform-specific path separators (e.g., `\\` on Windows) in test nodeids, unlike `pytest` which normalizes to forward slashes (`/`). This can affect tools or scripts parsing test output.","severity":"gotcha","affected_versions":"All versions"},{"fix":"If collection fails, try simplifying test module structure, reducing dynamic imports, or consider using `rtest --runner pytest` which leverages pytest for execution while still benefiting from rtest's collection.","message":"Collection Failures on Complex Codebases: Projects with extensive use of `pytest` plugins, dynamic imports, or metaclass-heavy patterns may fail during rtest collection, even if they work with `pytest`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"For projects relying on `pytest` fixtures, use `rtest --runner pytest` to execute tests. Full fixture support for the native runner is under development.","message":"`--runner native` Limitations: The native test runner is limited to simple test patterns (e.g., `unittest.TestCase`, plain assertions) and currently lacks full support for `pytest` fixtures or `conftest.py`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure parametrized arguments are statically resolvable for rtest to discover them. Refactor complex dynamic parameter generation if tests are not being collected.","message":"Limited Parametrized Test Discovery: Rtest only expands parametrized tests during collection when decorator arguments can be statically resolved (e.g., literal values, module-level constants, enum members). Dynamic expressions may not be discovered.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}