# AttributeError: 'TestCase' object has no attribute 'subTest'

- **ID:** `python/pytest-subtest-in-pytest`
- **Domain:** python
- **Category:** type_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

A unittest.TestCase test using self.subTest was collected by pytest but the class doesn't inherit from unittest.TestCase, or the wrong base class was imported (e.g., pytest.TestCase doesn't exist).

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 7.x | active | — | — |
| 8.x | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   import unittest

class TestMath(unittest.TestCase):
    def test_add(self):
        for a, b, expected in [(1,1,2),(2,2,4)]:
            with self.subTest(a=a, b=b):
                self.assertEqual(a+b, expected)
   ```
2. **** (88% success)
   ```
   pip install pytest-subtests
# then use pytest.mark.parametrize instead of subTest
   ```

## Dead Ends

- **** — Plugin helps pytest-side subtest support, but missing TestCase inheritance is the real issue. (70% fail)
- **** — Loses per-case reporting and stops at first failure. (75% fail)
- **** — Masks the class hierarchy bug. (90% fail)
