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