Fix test failures with newer flake8 and pylint.

Closes: #891721
Signed-off-by: Mattia Rizzolo <mattia@debian.org>
This commit is contained in:
Mattia Rizzolo 2018-03-08 12:56:36 +01:00
parent 157411a199
commit edb49c652c
No known key found for this signature in database
GPG Key ID: 0816B9E18C762BAD
6 changed files with 18 additions and 10 deletions

7
debian/changelog vendored
View File

@ -1,3 +1,10 @@
ubuntu-dev-tools (0.162) UNRELEASED; urgency=medium
* Team upload.
* Fix test failures with newer flake8 and pylint. Closes: #891721
-- Mattia Rizzolo <mattia@debian.org> Thu, 08 Mar 2018 12:35:24 +0100
ubuntu-dev-tools (0.161) unstable; urgency=medium ubuntu-dev-tools (0.161) unstable; urgency=medium
* Team upload. * Team upload.

View File

@ -232,7 +232,7 @@ Content-Type: text/plain; charset=UTF-8
'invalid username and password.') 'invalid username and password.')
s.quit() s.quit()
return return
except: except smtplib.SMTPException:
Logger.error('Unknown SMTP error.') Logger.error('Unknown SMTP error.')
s.quit() s.quit()
return return

View File

@ -73,7 +73,7 @@ class Patch(object):
cmd = ["diffstat", "-l", "-p0", self._full_path] cmd = ["diffstat", "-l", "-p0", self._full_path]
process = subprocess.Popen(cmd, stdout=subprocess.PIPE) process = subprocess.Popen(cmd, stdout=subprocess.PIPE)
changed_files = process.communicate()[0] changed_files = process.communicate()[0]
self._changed_files = [l for l in changed_files.split("\n") if l != ""] self._changed_files = [f for f in changed_files.split("\n") if f != ""]
def get_strip_level(self): def get_strip_level(self):
"""Returns the stript level for the patch.""" """Returns the stript level for the patch."""

View File

@ -20,7 +20,7 @@ import sys
import locale import locale
try: try:
from StringIO import StringIO from StringIO import StringIO
except: except ImportError:
from io import StringIO from io import StringIO
import mock import mock

View File

@ -16,7 +16,7 @@
try: try:
from StringIO import StringIO from StringIO import StringIO
except: except ImportError:
from io import StringIO from io import StringIO
import sys import sys

View File

@ -40,9 +40,10 @@ class PylintTestCase(unittest.TestCase):
cmd = [pylint_binary, '--rcfile=ubuntutools/test/pylint.conf', '-E', cmd = [pylint_binary, '--rcfile=ubuntutools/test/pylint.conf', '-E',
'--reports=n', '--confidence=HIGH', '--'] + files '--reports=n', '--confidence=HIGH', '--'] + files
sys.stderr.write("Running following command:\n{}\n".format(" ".join(cmd))) sys.stderr.write("Running following command:\n{}\n".format(" ".join(cmd)))
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, try:
stderr=subprocess.PIPE, close_fds=True) subprocess.check_output(cmd, stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
out, err = process.communicate() self.fail(
self.assertFalse(err, pylint_binary + ' crashed. Error output:\n' + err.decode()) '%s crashed (%d). Error output:\n%s' %
self.assertFalse(out, pylint_binary + " found issues:\n" + out.decode()) (pylint_binary, e.returncode, e.output.decode())
)