Skip to content

Commit

Permalink
test: prepare test/message/testcfg.py for Python 3
Browse files Browse the repository at this point in the history
PR-URL: #24793
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
  • Loading branch information
cclauss authored and MylesBorins committed Dec 7, 2018
1 parent 022599c commit a5c8af7
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion test/message/testcfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@
from os.path import join, exists, basename, isdir
import re

try:
reduce # Python 2
except NameError: # Python 3
from functools import reduce

try:
xrange # Python 2
except NameError:
xrange = range # Python 3

FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)")

class MessageTestCase(test.TestCase):
Expand All @@ -49,7 +59,7 @@ def IgnoreLine(self, str):
else: return str.startswith('==') or str.startswith('**')

def IsFailureOutput(self, output):
f = file(self.expected)
f = open(self.expected)
# Skip initial '#' comment and spaces
#for line in f:
# if (not line.startswith('#')) and (not line.strip()):
Expand Down

0 comments on commit a5c8af7

Please sign in to comment.