Tox environment variables with Django

Here’s my tox.ini :

[tox]
envlist = django19, django110
skipsdist = True

[testenv]
commands = pytest
setenv =
    DJANGO_SETTINGS_MODULE=gollahalli_com.settings
    PYTHONPATH={toxinidir}

[base]
deps =
    -r{toxinidir}/requirements-testing.txt
passenv =
    AUTHY_API
    cloudinary_api
    cloudinary_api_secret
    DEBUG
    SECRET_KEY
    GITHUB_KEY

[testenv:django19]
deps =
    django>=1.9, <1.10
    {[base]deps}
    {[base]passenv}

[testenv:django110]
deps =
    django>=1.10, <1.11
    {[base]deps}
    {[base]passenv}

[testenv:coverage]
commands =
;    coverage run --branch --omit={envdir}/*,test_app/*.py,*/migrations/*.py {envbindir}/manage.py test
    pytest --cov=./
    codecov
deps =
    {[testenv:django110]deps}
    {[base]passenv}

my environment variables won’t pass in any ideas? not sure what’s going on here

Looked through your tox.ini file, the bug is pretty obvious:

deps =
    {[base]passenv}

In your code, you passed the list of env vars as dependencies. Move passenv to [testenv] and remove {[base]passenv} from all environments/instances.

1 Like

you are amazing @montana, this was exactly the issue, thank you…

Great to hear I could help you fix this, happy new year!