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

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


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


[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 部分具有正确的退出代码。


然而,当使用 tox 运行时,它会吞下退出代码并且总是成功。


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


一只名叫tom的猫
浏览 192回答 1
1回答

叮当猫咪

以单个破折号字符开头的命令意味着忽略退出代码。[1]commands =  sh -c 'find . -iname "*.py" | grep -v .tox | xargs pylint -sn --output-format=colorized --rcfile={toxinidir}/.pylintrc'
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python