When trying to use Tox to better streamline testing across multiple environments, I'm runing into the following error when testing for Python 3.4:
ImportError: No module named 'debug_toolbar'
However, django-debug-toolbar==1.3.0
is listed in my requirements.txt
file, and my tox.ini
file looks as follows:
[tox]
envlist = py27,py34
skipsdist = True
[testenv]
deps = -r{toxinidir}/requirements.txt
setenv =
PYTHONPATH = {toxinidir}:{toxinidir}
commands = python manage.py test
It seems as if it is not properly installing the requirements.. Oddly enough, the py27 environment does not throw this error, and is able to perform the tests just fine.
What could be causing this?
EDIT: for reference, here's my current setup. When I run tox the first time (i.e. without .tox), it works fine, but any times after that it fails. The .tox
directory does seem to get build up correctly; all dependencies are installed in .tox/py34/lib/python3.4/site-packages
. Compared to earlier, I now also uninstalled django
, and indeed that is now the first dependency that fails.
(venv)joost@thorin:myproject/ (master✗) % rm -rf .tox
(venv)joost@thorin:myproject/ (master✗) % cat tox.ini
[tox]
envlist = py27,py34
skipsdist = True
[testenv]
deps = -r{toxinidir}/requirements.txt
commands = python manage.py test
(venv)joost@thorin:myproject/ (master✗) % tox
py27 create: /Users/Joost/myproject/.tox/py27
py27 installdeps: -r/Users/Joost/myproject/requirements.txt
py27 runtests: PYTHONHASHSEED='4248725049'
py27 runtests: commands[0] | python manage.py test
Creating test database for alias 'default'...
................
----------------------------------------------------------------------
Ran 16 tests in 0.093s
OK
Destroying test database for alias 'default'...
py34 create: /Users/Joost/myproject/.tox/py34
py34 installdeps: -r/Users/Joost/myproject/requirements.txt
py34 runtests: PYTHONHASHSEED='4248725049'
py34 runtests: commands[0] | python manage.py test
Creating test database for alias 'default'...
................
----------------------------------------------------------------------
Ran 16 tests in 0.093s
OK
Destroying test database for alias 'default'...
____________________________________________________________________ summary _____________________________________________________________________
py27: commands succeeded
py34: commands succeeded
congratulations :)
(venv)joost@thorin:myproject/ (master✗) % tox
py27 runtests: PYTHONHASHSEED='3259360769'
py27 runtests: commands[0] | python manage.py test
Creating test database for alias 'default'...
................
----------------------------------------------------------------------
Ran 16 tests in 0.088s
OK
Destroying test database for alias 'default'...
py34 runtests: PYTHONHASHSEED='3259360769'
py34 runtests: commands[0] | python manage.py test
Traceback (most recent call last):
File "manage.py", line 8, in <module>
from django.core.management import execute_from_command_line
ImportError: No module named 'django'
ERROR: InvocationError: '/Users/Joost/myproject/.tox/py34/bin/python manage.py test'
____________________________________________________________________ summary _____________________________________________________________________
py27: commands succeeded
ERROR: py34: commands failed
(venv)joost@thorin:myproject/ (master✗) %