Tox 运行 shell 命令并获取正确的退出代码

Tox run shell command and get correct exit code

我有以下 tox.ini 文件到 运行 pylint。

它抓取所有 python 个文件,然后对它们进行 lints。

[testenv:pylint]
deps =
  -rrequirements.txt
basepython=python2
commands =
  - sh -c 'find . -iname "*.py" | grep -v .tox | xargs pylint -sn --output-format=colorized --rcfile={toxinidir}/.pylintrc'

运行 只有命令行上的 shell 部分具有正确的退出代码。

然而,当 运行ning 使用 tox 时,它会吞下退出代码并始终成功。

tox 在使用 sh -c 选项时是否有正确的退出代码?

以单个破折号字符启动命令意味着忽略退出代码。 [1]

commands =
  sh -c 'find . -iname "*.py" | grep -v .tox | xargs pylint -sn --output-format=colorized --rcfile={toxinidir}/.pylintrc'