# NameError: name 'setup_method' is not defined

- **ID:** `python/nameerror-name-not-defined`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

A test class uses a method like setup_method without defining it, or it is misspelled.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.8 | active | — | — |
| 3.9 | active | — | — |
| 3.10 | active | — | — |

## Workarounds

1. **Define setup_method as class method** (95% success)
   ```
   class TestClass:
    def setup_method(self):
        pass
   ```
2. **Use pytest fixture instead** (90% success)
   ```
   @pytest.fixture(autouse=True)
def setup_method(self):
    pass
   ```

## Dead Ends

- **Defining setup_method inside test function** — setup_method should be a method of the test class, not nested inside a test. (70% fail)
- **Using setup_method as a fixture** — setup_method is a unittest convention; pytest uses fixtures instead. (50% fail)
