如何将travis环境变量添加到Tox
How to add travis environment variables to Tox
我的项目使用了环境变量,我正试图在 Tox 中使用它们。根据 ,我必须在 tox.ini
中设置 passenv
,但是当我这样做时,出现错误
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
看起来 Tox 认为 AUTHY_API
是一个分发文件,但它实际上是一个环境变量。
我的配置是:
.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}
我不确定这里有什么问题。求助!
这是错误:
deps =
…
{[base]passenv}
您将环境变量列表作为依赖项传递。将 passenv
移动到 [testenv]
并从所有环境中删除 {[base]passenv}
。
我的项目使用了环境变量,我正试图在 Tox 中使用它们。根据 tox.ini
中设置 passenv
,但是当我这样做时,出现错误
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
看起来 Tox 认为 AUTHY_API
是一个分发文件,但它实际上是一个环境变量。
我的配置是:
.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}
我不确定这里有什么问题。求助!
这是错误:
deps =
…
{[base]passenv}
您将环境变量列表作为依赖项传递。将 passenv
移动到 [testenv]
并从所有环境中删除 {[base]passenv}
。