【问题标题】:How do I tell tox not to collect tests from dependencies?如何告诉 tox 不要从依赖项中收集测试?
【发布时间】:2012-06-20 09:50:17
【问题描述】:

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

我该怎么做?

【问题讨论】:

  • 您能否通过包含您的 tox.ini 来更新问题?在 tox 中没有任何东西要求在 deps 本身中运行测试。

标签: python unit-testing tox


【解决方案1】:

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

有鼻子:

[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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-03-03
    • 2011-10-23
    • 1970-01-01
    • 2015-07-04
    • 2013-10-07
    • 2018-03-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多