# Failed: Fixture "frozen_time" 被直接调用。请改用 "freezer"。

- **ID:** `python/pytest-freeze-time-fixture-conflict`
- **领域:** python
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

pytest-freezegun/freezegun-time 插件将 `frozen_time` 作为底层辅助对象暴露；测试必须请求 `freezer`（fixture），由它管理冻结/解冻生命周期。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 0.3 | active | — | — |
| 0.9 | active | — | — |

## 解决方案

1. **** (95% 成功率)
   ```
   Request the freezer fixture:

def test_expiry(freezer):
    freezer.move_to('2024-01-01')
    assert is_expired()
   ```
2. **** (92% 成功率)
   ```
   Or use the decorator form:

from freezegun import freeze_time

@freeze_time('2024-01-01')
def test_expiry(): ...
   ```

## 无效尝试

- **** — The plugin detects direct access and raises the same failure. (90% 失败率)
- **** — Bypasses the fixture and leaves time frozen across other tests, causing cascading failures. (80% 失败率)
