Testing with Pyvorin

May 30, 2026 | 5 min read

pytest Integration

Run your test suite against compiled code with a custom pytest plugin or conftest:

# conftest.py
import pytest

def pytest_collection_modifyitems(config, items):
    for item in items:
        if hasattr(item, 'obj'):
            # Optionally pre-compile test functions
            pass

Correctness Testing

Always verify that compiled output matches CPython:

def test_compiled_output_matches_cpython():
    result_cpython = my_function()
    result_native = pyvorin.run_native(my_function)
    assert result_cpython == result_native

Benchmark Tests

def test_performance_regression():
    import time
    start = time.time()
    result = my_function()
    elapsed = time.time() - start
    assert elapsed < 0.1  # regression guard

Continuous Integration

  • Run pyvorin scan in CI to catch unsupported patterns before merge.
  • Run pyvorin benchmark on key functions and assert minimum speedup.
  • Fail the build on correctness_match=False.