# Failed: assert False, '自定义失败消息'

- **ID:** `python/pytest-fail-with-traceback`
- **领域:** python
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

测试使用 `pytest.fail('Custom failure message')` 或 `assert False` 故意失败，通常用于调试或条件失败逻辑。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.8 | active | — | — |
| 3.9 | active | — | — |
| 3.10 | active | — | — |
| 3.11 | active | — | — |
| 3.12 | active | — | — |

## 解决方案

1. **** (90% 成功率)
   ```
   Use pytest.skip() instead if the test is not yet ready: `pytest.skip('Test not implemented')`
   ```
2. **** (95% 成功率)
   ```
   Implement the missing logic and remove the fail statement.
   ```

## 无效尝试

- **** — The fail might be intentional to indicate an unimplemented test; removing it hides the gap. (70% 失败率)
- **** — This turns a failing test into a passing one, which can mask real issues. (90% 失败率)
