# pytest-cache: failed to write cache file /path/.pytest_cache/v/cache/lastfailed: [Errno 13] Permission denied

- **ID:** `python/pytest-cache-provider-error`
- **Domain:** python
- **Category:** system_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

pytest 缓存目录没有写入权限，通常因为运行用户或目录权限设置。

## Version Compatibility

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

## Workarounds

1. **修改目录权限** (90% success)
   ```
   chmod -R u+w .pytest_cache
   ```
2. **禁用缓存插件** (85% success)
   ```
   pytest -p no:cacheprovider
   ```

## Dead Ends

- **删除 .pytest_cache** — 尝试删除缓存目录但权限问题依然存在 (50% fail)
- **chmod 777** — 尝试修改目录所有者但需要 root 权限 (40% fail)
