# AssertionError: assert 0 == 1
# passes with -p no:xdist, fails with -n auto

- **ID:** `python/pytest-xdist-order-dependent`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Tests share global state (module-level dict, singleton, or DB row) that is mutated by one test and relied upon by another. pytest-xdist distributes tests across workers, breaking the implicit ordering.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.x | active | — | — |
| 4.x | active | — | — |

## Workarounds

1. **** (92% success)
   ```
   @pytest.fixture(autouse=True)
def reset_state():
    mypkg.cache.clear()
    yield
    mypkg.cache.clear()
   ```
2. **** (80% success)
   ```
   pytest -n auto --dist=loadscope
   ```

## Dead Ends

- **** — Hides the underlying state leak and defeats the purpose of using xdist for speed. (70% fail)
- **** — Shuffling makes the flakiness worse and harder to reproduce, not better. (80% fail)
