Fix gate failures by a new pycodestyle

pycodestyle 2.5.0 introduces E117 over-indented.
This commit fixes E117 errors.

pycodestyle 2.5.0 also drops pep8.py. As a result,
horizon/test/unit/hacking/test_checks.py starts to fail.
The equivalent elements are provided by pycodestyle.py,
so we can consume pycodestyle instead of pep8 module.

Change-Id: Ib103998f42ce7c901a10669b771a898783ca1a92
This commit is contained in:
Akihiro Motoki 2019-01-30 17:02:20 +09:00
parent 65545fb159
commit b06657b07d
7 changed files with 48 additions and 48 deletions

View File

@ -15,7 +15,7 @@
import textwrap
import mock
import pep8
import pycodestyle
from horizon.hacking import checks
from horizon.test import helpers
@ -80,14 +80,14 @@ class HackingTestCase(helpers.TestCase):
# We are patching pep8 so that only the check under test is actually
# installed.
@mock.patch('pep8._checks',
@mock.patch('pycodestyle._checks',
{'physical_line': {}, 'logical_line': {}, 'tree': {}})
def _run_check(self, code, checker, filename=None):
pep8.register_check(checker)
pycodestyle.register_check(checker)
lines = textwrap.dedent(code).strip().splitlines(True)
checker = pep8.Checker(filename=filename, lines=lines)
checker = pycodestyle.Checker(filename=filename, lines=lines)
checker.check_all()
checker.report._deferred_print.sort()
return checker.report._deferred_print