毒物多重检测,重复使用毒物环境

2024-06-06 08:46:51 发布

您现在位置:Python中文网/ 问答频道 /正文

是否可以使用单个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

Tags: depstesttruetoxflake8pytesterrorcommands
1条回答
网友
1楼 · 发布于 2024-06-06 08:46:51

tox在第一个失败的命令处停止。因此,我的建议是将命令从fasterst排序为slowest,并允许tox执行其余的操作:

[testenv]
commands =
    flake8 .
    pylint .
    mypy .  strict
    pytest

相关问题 更多 >