# pytest.PytestUnraisableExceptionWarning: Exception ignored in: <sqlite3.Connection object>

- **ID:** `python/pytest-random-order-fixture-collision`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

pytest-randomly reorders tests; a fixture that relied on side effects from a previously-run test (implicit ordering) now runs first, leaving resources in an unexpected state and triggering unraisable exceptions at GC.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.15.x | active | — | — |

## Workarounds

1. **** (93% success)
   ```
   @pytest.fixture
def db(tmp_path):
    p = tmp_path / 'test.db'
    conn = sqlite3.connect(p)
    conn.executescript(SCHEMA)
    yield conn
    conn.close()
   ```
2. **** (85% success)
   ```
   pytest --randomly-seed=last -x -q
# Reproduce, then refactor fixtures to remove cross-test state
   ```

## Dead Ends

- **** — Hides the ordering bug; CI with a different seed will still fail, and the fixture remains order-dependent. (75% fail)
- **** — Makes local runs deterministic but the underlying implicit dependency remains; any seed change re-exposes the bug. (70% fail)
