# FAILED tests/test_math.py::test_ops - AssertionError: 1 != 2

- **ID:** `python/pytest-subtests-not-counted`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

When using `self.subTest(...)` inside a unittest.TestCase, subtests do not stop the parent test from continuing, but the parent still reports as FAILED. Developers expect each subtest to appear as a separate test case.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.10 | active | — | — |
| 3.12 | active | — | — |

## Workarounds

1. **** (98% success)
   ```
   Use pytest's parametrize instead for per-case reporting:

import pytest

@pytest.mark.parametrize('a,b,expected', [(1,1,2),(2,2,4)])
def test_add(a, b, expected):
    assert a + b == expected
   ```
2. **** (90% success)
   ```
   Install pytest-subtests to surface each subTest as its own result:

pip install pytest-subtests

# now each subTest failure is reported individually
   ```

## Dead Ends

- **** — Loses the loop-based data-driven style; verbose but works, so it is not really a dead end—more of a workaround. (30% fail)
- **** — Raises immediately, aborting remaining subtests and defeating the purpose of subTest. (90% fail)
