# AssertionError: assert 0 == 3
  # passes when run alone, fails in full suite

- **ID:** `python/pytest-test-order-dependency-flaky`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Tests share module-level or database state and depend on execution order. A prior test mutates global state (e.g., a registry dict) that a later test assumes is pristine, so the test passes in isolation but fails in the full run.

## Version Compatibility

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

## Workarounds

1. **** (93% success)
   ```
   @pytest.fixture(autouse=True)
def reset_registry():
    registry.clear()
    yield
    registry.clear()
   ```
2. **** (90% success)
   ```
   @pytest.fixture
def app():
    return App()  # fresh per test
   ```

## Dead Ends

- **** — Disabling random ordering makes the order fixed but does not remove the shared-state dependency; it just hides it under one deterministic order. (60% fail)
- **** — Reruns may eventually pass but the underlying state leak persists and slows the suite. (70% fail)
