# AssertionError: assert 5 == 3
# but passes when run individually: pytest tests/test_counter.py::test_reset passes

- **ID:** `python/pytest-session-fixture-mutation-leak`
- **Domain:** python
- **Category:** data_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

A session-scoped fixture holds mutable state that a previous test mutated; test order dependence makes it pass in isolation but fail in the full run.

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   @pytest.fixture
def counter():
    return Counter()  # function scope, fresh each test

# or use a factory:
@pytest.fixture
def make_counter():
    def _make():
        return Counter()
    return _make
   ```
2. **** (88% success)
   ```
   @pytest.fixture(autouse=True)
def reset_state():
    yield
    global_state.clear()
   ```

## Dead Ends

- **** — May make the suite pass by accident on one order, but the underlying shared state bug remains. (70% fail)
- **** — Timing is not the issue; state leakage is. The failure persists. (90% fail)
