|
16 | 16 |
|
17 | 17 | import mock
|
18 | 18 | import pycodestyle
|
19 |
| -import testtools |
20 | 19 |
|
21 | 20 | from nova.hacking import checks
|
22 | 21 | from nova import test
|
@@ -276,7 +275,7 @@ def __get_msg(fun):
|
276 | 275 | def _run_check(self, code, checker, filename=None):
|
277 | 276 | pycodestyle.register_check(checker)
|
278 | 277 |
|
279 |
| - lines = textwrap.dedent(code).strip().splitlines(True) |
| 278 | + lines = textwrap.dedent(code).lstrip().splitlines(True) |
280 | 279 |
|
281 | 280 | checker = pycodestyle.Checker(filename=filename, lines=lines)
|
282 | 281 | # NOTE(sdague): the standard reporter has printing to stdout
|
@@ -578,19 +577,17 @@ def test_check_config_option_in_central_place(self):
|
578 | 577 | checks.check_config_option_in_central_place,
|
579 | 578 | filename="nova/tests/dummy_test.py")
|
580 | 579 |
|
581 |
| - # TODO(cdent): Remove when https://bugs.launchpad.net/nova/+bug/1804062 |
582 |
| - # is resolved. |
583 |
| - @testtools.skip( |
584 |
| - 'tokenize has backwards incompatible behavior from 3.6.7 and 2.7.15') |
585 | 580 | def test_check_doubled_words(self):
|
586 | 581 | errors = [(1, 0, "N343")]
|
587 | 582 |
|
588 |
| - # Artificial break to stop flake8 detecting the test ! |
589 |
| - 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" |
590 | 587 | self._assert_has_errors(code, checks.check_doubled_words,
|
591 | 588 | expected_errors=errors)
|
592 | 589 |
|
593 |
| - code = "This is the then best comment" |
| 590 | + code = "'This is the then best comment'\n" |
594 | 591 | self._assert_has_no_errors(code, checks.check_doubled_words)
|
595 | 592 |
|
596 | 593 | def test_dict_iteritems(self):
|
|
0 commit comments