Py.test command fails in Tox while it works from the command line in new env

931 Views Asked by At

I encountered a very strange behaviour. I have a Django app which I would like to test. I created a fresh virtual environment, populated it with py.test and pytest-django and ran the tests with py.test --pyargs app.tests.__init__ --ds=app.tests.settings. Everything worked as expected.

Now, I want to run tests using tox. I've also installed tox in my above virtual environment, added these line to 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__}

When I entered tox in the command line, all tests started failing.

This is very weird since I use the same command for tox. The only app dependency is Django.

0

There are 0 best solutions below