mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
script/lazytox: Ensure Flake8 passes for tests/ (#13794)
This commit is contained in:
parent
c8a464d8f9
commit
bd93f10d3c
@ -18,7 +18,7 @@ except ImportError:
|
|||||||
|
|
||||||
|
|
||||||
RE_ASCII = re.compile(r"\033\[[^m]*m")
|
RE_ASCII = re.compile(r"\033\[[^m]*m")
|
||||||
Error = namedtuple('Error', ['file', 'line', 'col', 'msg'])
|
Error = namedtuple('Error', ['file', 'line', 'col', 'msg', 'skip'])
|
||||||
|
|
||||||
PASS = 'green'
|
PASS = 'green'
|
||||||
FAIL = 'bold_red'
|
FAIL = 'bold_red'
|
||||||
@ -109,8 +109,9 @@ async def pylint(files):
|
|||||||
line = line.split(':')
|
line = line.split(':')
|
||||||
if len(line) < 3:
|
if len(line) < 3:
|
||||||
continue
|
continue
|
||||||
res.append(Error(line[0].replace('\\', '/'),
|
_fn = line[0].replace('\\', '/')
|
||||||
line[1], "", line[2].strip()))
|
res.append(Error(
|
||||||
|
_fn, line[1], '', line[2].strip(), _fn.startswith('tests/')))
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
@ -122,8 +123,8 @@ async def flake8(files):
|
|||||||
line = line.split(':')
|
line = line.split(':')
|
||||||
if len(line) < 4:
|
if len(line) < 4:
|
||||||
continue
|
continue
|
||||||
res.append(Error(line[0].replace('\\', '/'),
|
_fn = line[0].replace('\\', '/')
|
||||||
line[1], line[2], line[3].strip()))
|
res.append(Error(_fn, line[1], line[2], line[3].strip(), False))
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
@ -144,7 +145,7 @@ async def lint(files):
|
|||||||
err_msg = "{} {}:{} {}".format(err.file, err.line, err.col, err.msg)
|
err_msg = "{} {}:{} {}".format(err.file, err.line, err.col, err.msg)
|
||||||
|
|
||||||
# tests/* does not have to pass lint
|
# tests/* does not have to pass lint
|
||||||
if err.file.startswith('tests/'):
|
if err.skip:
|
||||||
print(err_msg)
|
print(err_msg)
|
||||||
else:
|
else:
|
||||||
printc(FAIL, err_msg)
|
printc(FAIL, err_msg)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user