Skip to content

Commit 9c6d900

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Fix double word hacking test" into stable/rocky
2 parents b8a2323 + 4858074 commit 9c6d900

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

nova/tests/unit/test_hacking.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ def __get_msg(fun):
275275
def _run_check(self, code, checker, filename=None):
276276
pep8.register_check(checker)
277277

278-
lines = textwrap.dedent(code).strip().splitlines(True)
278+
lines = textwrap.dedent(code).lstrip().splitlines(True)
279279

280280
checker = pep8.Checker(filename=filename, lines=lines)
281281
# NOTE(sdague): the standard reporter has printing to stdout
@@ -580,12 +580,14 @@ def test_check_config_option_in_central_place(self):
580580
def test_check_doubled_words(self):
581581
errors = [(1, 0, "N343")]
582582

583-
# Artificial break to stop pep8 detecting the test !
584-
code = "This is the" + " the best comment"
583+
# Explicit addition of line-ending here and below since this isn't a
584+
# block comment and without it we trigger #1804062. Artificial break is
585+
# necessary to stop flake8 detecting the test
586+
code = "'This is the" + " the best comment'\n"
585587
self._assert_has_errors(code, checks.check_doubled_words,
586588
expected_errors=errors)
587589

588-
code = "This is the then best comment"
590+
code = "'This is the then best comment'\n"
589591
self._assert_has_no_errors(code, checks.check_doubled_words)
590592

591593
def test_dict_iteritems(self):

0 commit comments

Comments
 (0)