Fix lint problems with long lines

This commit is contained in:
Seth Schoen 2019-01-30 15:12:55 -08:00
parent ab57467944
commit 2248369777
2 changed files with 9 additions and 4 deletions

View file

@ -211,7 +211,9 @@ class NginxParser(object):
except IOError:
logger.warning("Could not open file: %s", item)
except UnicodeDecodeError:
logger.warning("Could not read file: %s due to invalid character. Only UTF-8 encoding is supported.", item)
logger.warning("Could not read file: %s due to invalid "
"character. Only UTF-8 encoding is "
"supported.", item)
except pyparsing.ParseException as err:
logger.debug("Could not parse file: %s due to %s", item, err)
return trees
@ -420,7 +422,8 @@ def _parse_ssl_options(ssl_options):
except IOError:
logger.warning("Missing NGINX TLS options file: %s", ssl_options)
except UnicodeDecodeError:
logger.warn("Could not read file: %s due to invalid character. Only UTF-8 encoding is supported.", ssl_options)
logger.warn("Could not read file: %s due to invalid character. "
"Only UTF-8 encoding is supported.", ssl_options)
except pyparsing.ParseBaseException as err:
logger.debug("Could not parse file: %s due to %s", ssl_options, err)
return []

View file

@ -453,14 +453,16 @@ class NginxParserTest(util.NginxTest): #pylint: disable=too-many-public-methods
def test_valid_unicode_characters(self):
nparser = parser.NginxParser(self.config_path)
# pylint: disable=protected-access
parsed = nparser._parse_files(nparser.abs_path('unicode_support/valid_unicode_comments.conf'))
path = nparser.abs_path('unicode_support/valid_unicode_comments.conf')
parsed = nparser._parse_files(path)
self.assertEqual(['server'], parsed[0][2][0])
self.assertEqual(['listen', '80'], parsed[0][2][1][3])
def test_invalid_unicode_characters(self):
nparser = parser.NginxParser(self.config_path)
# pylint: disable=protected-access
parsed = nparser._parse_files(nparser.abs_path('unicode_support/invalid_unicode_comments.conf'))
path = nparser.abs_path('unicode_support/invalid_unicode_comments.conf')
parsed = nparser._parse_files(path)
self.assertEqual([], parsed)
def test_duplicate_vhost_remove_ipv6only(self):