handle_test_failurelisted
Install: claude install-skill feralbureau/luminy
# handle_test_failure
A failing test tells you one of three things: the code is broken (the test found a real bug), the test is broken (the assertion is wrong), or the test environment is wrong (flaky, leaking state, wrong fixtures). Figuring out which one is step zero.
## Step 1: Read the Full Test Failure
Don't just look at the error message — read the full failure output, which includes:
1. **Which test failed** — the test name tells you what behavior was being tested.
2. **The assertion** — what was expected vs. what was actual.
3. **The stack trace** — where in the code the failure occurred.
**Pytest example:**
```
FAILED tests/test_order_service.py::test_apply_discount_reduces_total - AssertionError: assert Decimal('60.0') == Decimal('54.0')
tests/test_order_service.py:45: AssertionError
____________________________ test_apply_discount_reduces_total _____________________________
def test_apply_discount_reduces_total():
order = Order(items=[Item(price=Decimal("60.0"))], coupon=Coupon(percentage=10))
> assert order.total == Decimal("54.0")
E AssertionError: assert Decimal('60.0') == Decimal('54.0')
```
The test says: "order with a 10% coupon should have total $54, but got $60." This tells us the discount isn't being applied.
## Step 2: Determine — Is the Code Wrong, or the Test Wrong?
This is the most important question. Ask:
**Is the expected value correct?**
- Re-derive the expected value from the business rule. If the order total is