gpt4 book ai didi

python - 如何告诉 tox 不要从依赖项收集测试?

转载 作者:太空宇宙 更新时间:2023-11-03 19:16:44 24 4
gpt4 key购买 nike

默认情况下,tox 也会从您的依赖项中收集测试,我希望它只从我的包中收集测试。

我该怎么做?

最佳答案

Tox 是一个工具,它为您配置的每个 python 版本创建一个新的 virtualenv,安装您正在运行的模块,然后运行用户指定的命令来运行测试。它实际上并不收集要运行的测试。这取决于您使用的测试工具:py.test、nose 等。要使用 tox 来做到这一点,您将编辑/创建一个 tox.ini 以使用正确的命令,将测试集合限制为您想要的任何内容.

带 Nose :

[tox]
envlist = py26,py27
[testenv]
deps=nose
commands=nosetests test.module

使用 py.test:

[tox]
envlist = py26,py27
[testenv]
deps=pytest
commands=py.test test.module

关于python - 如何告诉 tox 不要从依赖项收集测试?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11116926/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com