Skip to content

Commit

Permalink
Fixes #293
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleck Landgraf committed Jun 2, 2016
1 parent 95e4047 commit 9035491
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions testsuite/E12.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,4 +373,8 @@ def example_issue254():

print(a
, end=' ')
#: E133:3:1 --hang-closing
a = [
12
]
#:
16 changes: 16 additions & 0 deletions testsuite/support.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,19 @@ def init_tests(pep8style):
report = pep8style.init_report(TestReport)
runner = pep8style.input_file

def set_hang_closing_option(pep8style, codes):
"""Set hang-closing option if present in the test codes.
(mutates pep8style)
Usage in test:
#: #E133:3:1 --with-hanging
"""
pep8style.options.hang_closing = '--hang-closing' in codes
codes = [c for c in codes if c != '--hang-closing']
return codes

def run_tests(filename):
"""Run all the tests from a file."""
lines = readlines(filename) + ['#:\n']
Expand All @@ -162,6 +175,9 @@ def run_tests(filename):
if codes and index:
if 'noeol' in codes:
testcase[-1] = testcase[-1].rstrip('\n')

codes = set_hang_closing_option(pep8style, codes)

codes = [c for c in codes
if c not in ('Okay', 'noeol')]
# Run the checker
Expand Down

0 comments on commit 9035491

Please sign in to comment.