【发布时间】:2020-04-03 08:32:05
【问题描述】:
我有一个 Python 项目,我使用 flake8 对代码进行 lint。
在本地,flake8 正确地提出了警告:
$ flake8 scripts src tests --ignore=W503,E501
src/projectname/workers/utils.py:22:20: W291 trailing whitespace
但是,tox 中的相同命令不会引发任何警告:
$ tox -e flake8
得到以下输出:
flake8 develop-inst-noop: /home/username/Projects/projectname
flake8 installed: alembic==0.9.8, ..., zipp==0.5.2
flake8 runtests: PYTHONHASHSEED='2190899390'
flake8 runtests: commands[0] | flake8 scripts src tests --ignore=W503,E501
________________________________ summary _________________________________
flake8: commands succeeded
congratulations :)
这是我的tox.ini 文件的内容:
[tox]
envlist = flake8,py36
[testenv]
changedir = {toxworkdir}/{envname}
usedevelop = True
install_command = pip install {opts} {packages}
deps =
py36: pytest-cov
py36: pytest
flake8: flake8
setenv =
COVERAGE_FILE = {toxinidir}/.coverage.{envname}
commands =
py36: pytest {toxinidir}/tests --cov=projectname {posargs}
flake8: flake8 scripts src tests --ignore=W503,E501
; E501: line too long
; W503: line break before binary operator
我检查了,在两个实验中,我都有flake8==3.7.9
为什么flake8 和tox 在这种情况下不应该返回任何错误代码?
【问题讨论】: