# Failed: Timeout (>30.0s) from pytest-timeout.
E   Failed: Timeout (>30.0s) from pytest-timeout.

- **ID:** `python/pytest-timeout-fixture-hang`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

A fixture opens a resource (socket, subprocess, lock) and blocks indefinitely; pytest-timeout aborts the test but the fixture teardown never runs.

## Version Compatibility

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

## Workarounds

1. **** (90% success)
   ```
   import socket

@pytest.fixture
def server():
    s = socket.socket()
    s.settimeout(5)
    try:
        s.connect(('localhost', 8080))
    except socket.timeout:
        pytest.skip('server not reachable')
    yield s
    s.close()
   ```
2. **** (85% success)
   ```
   pytest --timeout=30 --timeout-method=thread --timeout-func-only -q
# Or set in pytest.ini:
# [pytest]
# timeout = 30
# timeout_method = thread
   ```

## Dead Ends

- **** — The hang is real, not slow; increasing the timeout only delays the failure and wastes CI time. (70% fail)
- **** — Removes the safety net; CI hangs forever. (90% fail)
