Fix some 2/3 differences and run pylint with confidence=HIGH

Too many false positives otherwise.
This commit is contained in:
Iain Lane 2017-05-30 11:21:52 +01:00
parent d41602ba83
commit 0a3738cfbc
3 changed files with 22 additions and 8 deletions

View File

@ -26,7 +26,7 @@ import sys
import ubuntutools.subprocess
if sys.version_info[0] < 3:
input = raw_input # noqa
input = raw_input # noqa, pylint: disable=undefined-variable
class Question(object):

View File

@ -199,16 +199,30 @@ Content-Type: text/plain; charset=UTF-8
mailserver_port)
s = smtplib.SMTP(mailserver_host, mailserver_port)
break
except socket.error as s:
Logger.error('Could not connect to %s:%s: %s (%i)',
mailserver_host, mailserver_port, s[1], s[0])
return
except smtplib.SMTPConnectError as s:
Logger.error('Could not connect to %s:%s: %s (%i)',
mailserver_host, mailserver_port, s[1], s[0])
try:
# py2 path
# pylint: disable=unsubscriptable-object
Logger.error('Could not connect to %s:%s: %s (%i)',
mailserver_host, mailserver_port, s[1], s[0])
except TypeError:
# pylint: disable=no-member
Logger.error('Could not connect to %s:%s: %s (%i)',
mailserver_host, mailserver_port, s.strerror, s.errno)
if s.smtp_code == 421:
confirmation_prompt(message='This is a temporary error, press [Enter] '
'to retry. Press [Ctrl-C] to abort now.')
except socket.error as s:
try:
# py2 path
# pylint: disable=unsubscriptable-object
Logger.error('Could not connect to %s:%s: %s (%i)',
mailserver_host, mailserver_port, s[1], s[0])
except TypeError:
# pylint: disable=no-member
Logger.error('Could not connect to %s:%s: %s (%i)',
mailserver_host, mailserver_port, s.strerror, s.errno)
return
if mailserver_user and mailserver_pass:
try:

View File

@ -38,7 +38,7 @@ class PylintTestCase(unittest.TestCase):
else:
pylint_binary = 'pylint'
cmd = [pylint_binary, '--rcfile=ubuntutools/test/pylint.conf', '-E',
'--reports=n', '--'] + files
'--reports=n', '--confidence=HIGH', '--'] + files
sys.stderr.write("Running following command:\n{}\n".format(" ".join(cmd)))
process = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, close_fds=True)