2017-06-26 1 views
0

Mein Projekt verwendet Umgebungsvariablen, und ich versuche, sie im Tox zu verwenden. Nach https://stackoverflow.com/a/37522926/3782963 habe ich passenv im tox.ini zu setzen, aber wenn ich, dass das tun, bekomme ich einen Fehler alsSo fügen Sie Travis-Umgebungsvariablen zu Tox hinzu

Collecting django<1.10,>=1.9 
    Using cached Django-1.9.13-py2.py3-none-any.whl 
Collecting AUTHY_API 
    Could not find a version that satisfies the requirement AUTHY_API (from versions:) 
No matching distribution found for AUTHY_API 

Es ist wie das Tox sieht denkt, dass AUTHY_API eine Verteilungsdatei ist, während es tatsächlich eine Umgebungsvariable ist .

Meine Konfigurationen sind:

.travis.yml:

language: python 

python: 
    - 3.5 
    - 3.6 

services: postgresql 

addons: 
    postgresql: "9.4" 

before_script: 
    - psql -c "CREATE DATABASE mydb;" -U postgres 

branches: 
    only: 
    - master 
    - v3 

install: 
    - pip install tox-travis 

script: 
    - tox 

env: 
    - TOXENV=django19 
    - TOXENV=django110 
    - TOXENV=coverage 

notifications: 
    email: false 

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} 

Ich bin nicht sicher, was hier nicht stimmt. Hilfe! Hier

Antwort

0

ist der Fehler:

deps = 
    … 
    {[base]passenv} 

Sie die Liste von env geben vars als Abhängigkeiten. Verschieben Sie passenv zu [testenv] und entfernen Sie {[base]passenv} aus allen Umgebungen.

+0

Danke das hat funktioniert. – Akshay