Skip to content

Commit 9035491

Browse files
author
Aleck Landgraf
committed
Fixes #293
1 parent 95e4047 commit 9035491

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

testsuite/E12.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,4 +373,8 @@ def example_issue254():
373373

374374
print(a
375375
, end=' ')
376+
#: E133:3:1 --hang-closing
377+
a = [
378+
12
379+
]
376380
#:

testsuite/support.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,19 @@ def init_tests(pep8style):
146146
report = pep8style.init_report(TestReport)
147147
runner = pep8style.input_file
148148

149+
def set_hang_closing_option(pep8style, codes):
150+
"""Set hang-closing option if present in the test codes.
151+
152+
(mutates pep8style)
153+
154+
Usage in test:
155+
#: #E133:3:1 --with-hanging
156+
157+
"""
158+
pep8style.options.hang_closing = '--hang-closing' in codes
159+
codes = [c for c in codes if c != '--hang-closing']
160+
return codes
161+
149162
def run_tests(filename):
150163
"""Run all the tests from a file."""
151164
lines = readlines(filename) + ['#:\n']
@@ -162,6 +175,9 @@ def run_tests(filename):
162175
if codes and index:
163176
if 'noeol' in codes:
164177
testcase[-1] = testcase[-1].rstrip('\n')
178+
179+
codes = set_hang_closing_option(pep8style, codes)
180+
165181
codes = [c for c in codes
166182
if c not in ('Okay', 'noeol')]
167183
# Run the checker

0 commit comments

Comments
 (0)