test: prepare test/message/testcfg.py for Python 3

PR-URL: https://github.com/nodejs/node/pull/24793
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
This commit is contained in:
cclauss 2018-12-03 09:57:54 +01:00 committed by Rich Trott
parent ae3ee28abd
commit 87592d1c48

View File

@ -31,6 +31,16 @@ import os
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):
@ -49,7 +59,7 @@ class MessageTestCase(test.TestCase):
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()):