Skip to content

Use actual test outcome

Replaces assertion expected values with the actual value from the last failed test run.

Failed tests are matched with the python_files, python_classes, and python_functions rules from the pytest configuration that applies to their project root, so custom test names and multi-root projects are supported.

How to invoke: ⌥⏎ / Alt+Enter on a failed assertion → "BetterPy: Use actual test outcome"

def test_total():
    assert calculate_total([10, 20]) == 25  # Failed: got 30
def test_total():
    assert calculate_total([10, 20]) == 30