# pytest-timeout: TimeoutError: Test timed out after 5.0 seconds

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

## Root Cause

The test takes longer than the timeout set by the pytest-timeout plugin, often due to infinite loops, slow I/O, or network delays.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.11 | active | — | — |

## Workarounds

1. **** (80% success)
   ```
   Optimize the test code to reduce execution time, e.g., by mocking slow external calls or reducing data size.
   ```
2. **** (85% success)
   ```
   Use a higher timeout for specific tests with @pytest.mark.timeout(10) if the test legitimately requires more time.
   ```

## Dead Ends

- **** — Increasing the timeout value may allow the test to pass but does not address the underlying performance issue. (50% fail)
- **** — Removing the timeout entirely may cause CI pipelines to hang indefinitely. (70% fail)
