Tox缓存的可靠性如何? [英] How reliable is Tox' caching?
问题描述
我将Tox用作所有python代码质量工具(例如flake8,mypy和pytest)的包装器.我还从詹金斯(Jenkins)调用Tox.
I am using Tox as a wrapper around all the python code quality tools like flake8, mypy and pytest. I also invoke Tox from Jenkins.
当前,对于我们每个git push
- 创建一个新的Conda环境,其中包含python = 3.7和tox
- 调用tox,它将重新创建所有虚拟环境
- 删除.tox/和Conda环境
由于此,在本地运行tox花费2秒,而在詹金斯中则花费90秒.
Due to this, running tox takes 2 seconds locally but 90 seconds in Jenkins.
我现在想知道我们是否要谨慎.将.tox/缓存文件夹留在Jenkin中可以吗?在[testenv]
中只有deps = -rrequirements-dev.txt
可能很重要.
I now wonder whether we are to cautious. Would it be ok to leave the .tox/ cache folder alone in Jenkin? It might be important that we have just deps = -rrequirements-dev.txt
in [testenv]
.
还有其他方法可以加快用tox进行测试的速度吗?
Are there other means to speed up testing with tox?
推荐答案
阅读 tox 文档中的依赖项更改和跟踪" ,看来requirements.txt
文件中的更改不会触发虚拟环境的重建.因此,看来您确实应该删除.tox
目录或至少使用tox的-r, --recreate
选项(这可能更有效).
Reading the tox documentation on "Dependency changes and tracking", it seems changes in a requirements.txt
file do not trigger the rebuild of the virtual environment. So it looks like you should indeed delete the .tox
directory or at least use the -r, --recreate
option of tox (which might be more efficient).
也许您可以提供tox插件,例如 tox-auto-env 或 tox-pip-extensions 试试.
Maybe you could give tox plugins such as tox-auto-env, or tox-pip-extensions a try.
虽然不知道重建 conda 环境的必要性.
Don't know about the necessity of rebuilding the conda environment though.
这篇关于Tox缓存的可靠性如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!