python - 防止pytest在Pycharm中创建.cache目录

标签 python caching pycharm pytest

我在今年的 Advent of Code 中使用 Pycharm,并使用 pytest 测试所有示例和输出。

如果 pytest 没有在我的目录树中创建 .cache 目录,我会更喜欢它。无论如何,当测试失败时,是否可以禁用 .cache 目录的创建?

最佳答案

有两个基本选项:

  • 完全禁用缓存(缓存由 cacheprovider 插件完成):

    pytest -p no:cacheprovider
    

    -p is used to disable plugins .

  • 通过调整 cache-dir configuration option 更改缓存位置(需要 pytest 3.2+)

    Sets a directory where stores content of cache plugin. Default directory is .cache which is created in rootdir. Directory may be relative or absolute path. If setting relative path, then directory is created relative to rootdir.

这里是一个带有 no:cacheprovider 的示例 PyCharm 运行配置:

enter image description here

关于python - 防止pytest在Pycharm中创建.cache目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47744076/

相关文章:

python - 在nltk bigraph的python中转换计数器列表

python - opencv 调整大小函数是否有最大数组大小限制?

spring - 在 Spring MVC Rest 服务中缓存 HTTP 响应

java - Ehcache 不在同一台机器上的两个 tomcat 之间复制

caching - 使用 Nginx 和 Etags 对动态内容进行服务器端缓存

python - 为什么 python-django 元素中管理 url 的 css 没有加载?

python - PyQt4 : How can i toggle the "Stay On Top" behavior?

PyCharm "Can' t 获取部署服务器的远程凭据”

jquery - 如何使用 PyCharm 和 Django 设置 jQuery 代码完成?

python - 在 pycharm 中将 .py 转换为 .ipynb 文件