我在今年的 Advent of Code 中使用 Pycharm,并使用 pytest 测试所有示例和输出。
如果 pytest 没有在我的目录树中创建 .cache 目录,我会更喜欢它。无论如何,当测试失败时,是否可以禁用 .cache 目录的创建?
最佳答案
有两个基本选项:
完全禁用缓存(缓存由
cacheprovider
插件完成):pytest -p no:cacheprovider
通过调整
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 运行配置:
关于python - 防止pytest在Pycharm中创建.cache目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47744076/