我有tox 2.9.1
$ tox --version
2.9.1 imported from /Library/Python/2.7/site-packages/tox/__init__.pyc
registered plugins:
tox-pyenv-1.1.0 at /Library/Python/2.7/site-packages/tox_pyenv.pyc
Run Code Online (Sandbox Code Playgroud)
文件结构和内容如下
$ tree .
.
??? setup.py
??? test_env.py
??? tox.ini
0 directories, 3 files
Run Code Online (Sandbox Code Playgroud)
setup.py
$ cat setup.py
from setuptools import setup
setup(name="Tox Testing")
Run Code Online (Sandbox Code Playgroud)
tox.ini
$ cat tox.ini
[tox]
envlist = py35
setenv =
XYZ = 123
[testenv]
deps=pytest
commands=py.test
Run Code Online (Sandbox Code Playgroud)
test_env.py
$ cat test_env.py
import os
def test_env():
assert os.getenv('XYZ') == 123
Run Code Online (Sandbox Code Playgroud)
当我运行tox
命令时,我的测试失败了.
$ tox -v
using tox.ini: /private/tmp/testing/tox.ini
using tox-2.9.1 from /Library/Python/2.7/site-packages/tox/__init__.pyc …
Run Code Online (Sandbox Code Playgroud)