是否可以使用单个tox虚拟环境执行以下操作?
[tox]
envlist = test, pylint, flake8, mypy
skipsdist = true
[testenv:lint]
deps = pylint
commands = pylint .
[testenv:flake8]
deps = flake8
commands = flake8 .
[testenv:mypy]
commands = mypy . --strict
[testenv:test]
deps = pytest
commands = pytest由于我只是在我的python版本(py3.7)上进行测试,所以我不想让tox创建4个环境(.tox/test、.tox/pylint、.tox/flake8、.tox/mypy),而这些环境都可以在单个环境上运行。
我还想看看个别的失败,因此我不想这样做:
[tox]
skipsdist = true
[testenv]
commands = pylint .
flake8 .
mypy . --strict
pytest因为输出是这样的:
_____________ summary ___________
ERROR: python: commands failed不是这样的:
____________________summary _________________
ERROR: test: commands failed
ERROR: lint: commands failed
ERROR: mypy: commands failed
test: commands succeeded发布于 2020-09-25 08:18:32
使用生成名称和特定于因素的命令(在tox配置文档页面中搜索这些术语以获得更多信息)将所有您想要的环境作为一个实现,以便它们共享相同的envdir:
[testenv:{lint,flake8,mypy,test}]
envdir = {toxworkdir}/.work_env
deps = pylint, flake8, pytest
commands =
lint: pylint .
flake8: flake8 .
mypy: mypy . --strict
test: pytest发布于 2019-07-26 16:04:14
tox在第一个失败命令处停止。因此,我的建议是命令从最快到最慢的命令,并允许tox执行其余的命令:
[testenv]
commands =
flake8 .
pylint .
mypy . --strict
pytesthttps://stackoverflow.com/questions/57222212
复制相似问题