# AttributeError: 'TempPathFactory' object has no attribute 'mktemp'

- **ID:** `python/pytest-tmpdir-factory-error`
- **Domain:** python
- **Category:** attribute_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

在非 pytest 环境中使用了 tmp_path_factory，或版本不支持该方法。

## Version Compatibility

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

## Workarounds

1. **** (100% success)
   ```
   在测试函数中直接使用 `tmp_path` 参数，pytest 自动提供。
   ```
2. **** (85% success)
   ```
   确保 pytest >= 7.0 并使用 `tmp_path_factory.mktemp('name')`。
   ```

## Dead Ends

- **** — 绕过 pytest 的临时目录管理，可能冲突。 (50% fail)
- **** — 如果已是最新版本，无济于事。 (40% fail)
