Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a5c8af7

Browse filesBrowse files
cclaussMylesBorins
authored andcommitted
test: prepare test/message/testcfg.py for Python 3
PR-URL: #24793 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
1 parent 022599c commit a5c8af7
Copy full SHA for a5c8af7

File tree

Expand file treeCollapse file tree

1 file changed

+11
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+11
-1
lines changed
Open diff view settings
Collapse file

‎test/message/testcfg.py‎

Copy file name to clipboardExpand all lines: test/message/testcfg.py
+11-1Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@
3131
from os.path import join, exists, basename, isdir
3232
import re
3333

34+
try:
35+
reduce # Python 2
36+
except NameError: # Python 3
37+
from functools import reduce
38+
39+
try:
40+
xrange # Python 2
41+
except NameError:
42+
xrange = range # Python 3
43+
3444
FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)")
3545

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

5161
def IsFailureOutput(self, output):
52-
f = file(self.expected)
62+
f = open(self.expected)
5363
# Skip initial '#' comment and spaces
5464
#for line in f:
5565
# if (not line.startswith('#')) and (not line.strip()):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.