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.
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
