我正在为我的项目使用 tox。
这是我的 tox.ini
文件:
[tox]
envlist =
py27,
lint,
coverage
skipsdist = True
[testenv:py27]
deps = -rrequirements.txt
commands = python -m unittest discover -s ./tests
[testenv:coverage]
commands =
coverage run --source=tests -m unittest discover -s tests/
coverage html
coverage report
[testenv:lint]
commands = pylint ./foo
每当我运行 tox 时,一切都会被执行,这基本上是 linting、覆盖率。
但 Tox 对所有内容都显示警告。
WARNING:test command found but not installed in testenv
Maybe you forgot to specify a dependency? See also the whitelist_externals envconfig setting.
一切顺利,但仍然显示警告和错误。谁能告诉我我做错了什么?
我的requirements.txt
文件是这样的:
requests==2.18.4
JsonForm==0.0.2
jsonify==0.5
jsonschema==2.6.0
JsonSir==0.0.2
python-dateutil==1.5
DateTime==4.2
urllib3==1.22
contextlib2==0.5.5
mock==2.0.0
patch==1.16
最佳答案
您在 commands
中使用的程序必须安装在 tox 的虚拟环境中或列入白名单:
[tox]
envlist =
py27,
lint,
coverage
skipsdist = True
[testenv:py27]
deps = -rrequirements.txt
whitelist_externals = python
commands = python -m unittest discover -s ./tests
[testenv:coverage]
whitelist_externals = coverage
commands =
coverage run --source=tests -m unittest discover -s tests/
coverage html
coverage report
[testenv:lint]
whitelist_externals = pylint
commands = pylint ./foo
关于python - 毒性警告 :test command found but not installed in testenv,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47642747/