mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
"Tee" the pylint output instead of echoing it at the end
This commit is contained in:
parent
594128ff75
commit
c5043618ac
1 changed files with 21 additions and 1 deletions
22
noxfile.py
22
noxfile.py
|
@ -895,6 +895,24 @@ def _pytest(session, coverage, cmd_args):
|
|||
# pylint: enable=unreachable
|
||||
|
||||
|
||||
class Tee:
|
||||
'''
|
||||
Python class to mimic linux tee behaviour
|
||||
'''
|
||||
def __init__(self, first, second):
|
||||
self._first = first
|
||||
self._second = second
|
||||
|
||||
def write(self, b):
|
||||
wrote = self._first.write(b)
|
||||
self._first.flush()
|
||||
self._second.write(b)
|
||||
self._second.flush()
|
||||
|
||||
def fileno(self):
|
||||
return self._first.fileno()
|
||||
|
||||
|
||||
def _lint(session, rcfile, flags, paths):
|
||||
_install_requirements(session, 'zeromq')
|
||||
requirements_file = 'requirements/static/lint.in'
|
||||
|
@ -920,7 +938,9 @@ def _lint(session, rcfile, flags, paths):
|
|||
stdout = tempfile.TemporaryFile(mode='w+b')
|
||||
lint_failed = False
|
||||
try:
|
||||
session.run(*cmd_args, stdout=stdout)
|
||||
session.run(*cmd_args,
|
||||
stdout=Tee(stdout, sys.__stdout__),
|
||||
env={'PYTHONUNBUFFERED': '1'})
|
||||
except CommandFailed:
|
||||
lint_failed = True
|
||||
raise
|
||||
|
|
Loading…
Add table
Reference in a new issue