python
system_error
ai_generated
true
pytest-cache: failed to write cache file /path/.pytest_cache/v/cache/lastfailed: [Errno 13] Permission denied
ID: python/pytest-cache-provider-error
80%Fix Rate
87%Confidence
0Evidence
2025-11-02First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.9 | active | — | — | — |
Root Cause
pytest 缓存目录没有写入权限,通常因为运行用户或目录权限设置。
generic中文
pytest 缓存目录没有写入权限,通常因为运行用户或目录权限设置。
Workarounds
-
90% success 修改目录权限
chmod -R u+w .pytest_cache
-
85% success 禁用缓存插件
pytest -p no:cacheprovider
Dead Ends
Common approaches that don't work:
-
删除 .pytest_cache
50% fail
尝试删除缓存目录但权限问题依然存在
-
chmod 777
40% fail
尝试修改目录所有者但需要 root 权限