# 权限错误：无法访问 /tmp/pytest-of-user/pytest-123/test_foo0 目录

- **ID:** `python/pytest-tmpdir-permission-error`
- **领域:** python
- **类别:** system_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

pytest 临时目录权限不足，或已被其他进程占用

## 版本兼容性

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

## 解决方案

1. **** (85% 成功率)
   ```
   pytest --basetemp=/home/user/mytmp
   ```
2. **** (70% 成功率)
   ```
   chmod -R 775 /tmp/pytest-of-user
   ```

## 无效尝试

- **** — 如果权限问题源于系统，删除可能失败或需要 root (50% 失败率)
- **** — 如果不了解配置方法，可能引入新问题 (40% 失败率)
