2

我遇到了一个非常奇怪的行为。我有一个想要测试的 Django 应用程序。我创建了一个全新的虚拟环境,使用 py.test 和 pytest-django 填充它,并使用py.test --pyargs app.tests.__init__ --ds=app.tests.settings. 一切都按预期工作。

现在,我想使用 tox 运行测试。我还在上面的虚拟环境中安装了 tox,将这些行添加到 tox.ini:

[tox]
envlist=pytest

[testenv:pytest]
install_command=
    pip install --use-mirrors -b .tox/build-pytest {opts} {packages}
deps=
    pytest-django
commands=
    py.test \
        --ds=app.tests.settings \
        --pyargs \
        {posargs:app.tests.__init__}

当我进入tox命令行时,所有测试都开始失败。

这很奇怪,因为我对 tox 使用了相同的命令。唯一的应用程序依赖项是 Django。

4

0 回答 0