# pytest.fail(_pytest.outcomes.Failed): test failed intentionally

- **ID:** `python/pytest-fail-outcomes-failed`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

pytest.fail() was called explicitly to mark a test as failed, often due to a custom condition.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.8 | active | — | — |
| 3.9 | active | — | — |
| 3.10 | active | — | — |

## Workarounds

1. **Use pytest.fail with a descriptive message** (90% success)
   ```
   pytest.fail('Custom failure: expected condition not met')
   ```
2. **Raise a custom exception with pytest.fail** (85% success)
   ```
   if not condition: pytest.fail('Condition failed: ' + str(condition))
   ```

## Dead Ends

- **Removing pytest.fail() call without fixing logic** — The underlying condition that triggered the fail remains unaddressed. (70% fail)
- **Replacing with assert False** — assert False does not provide a custom message and may be less informative. (50% fail)
