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:
parent
ae3ee28abd
commit
87592d1c48
@ -31,6 +31,16 @@ import os
|
|||||||
from os.path import join, exists, basename, isdir
|
from os.path import join, exists, basename, isdir
|
||||||
import re
|
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:(.*)")
|
FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)")
|
||||||
|
|
||||||
class MessageTestCase(test.TestCase):
|
class MessageTestCase(test.TestCase):
|
||||||
@ -49,7 +59,7 @@ class MessageTestCase(test.TestCase):
|
|||||||
else: return str.startswith('==') or str.startswith('**')
|
else: return str.startswith('==') or str.startswith('**')
|
||||||
|
|
||||||
def IsFailureOutput(self, output):
|
def IsFailureOutput(self, output):
|
||||||
f = file(self.expected)
|
f = open(self.expected)
|
||||||
# Skip initial '#' comment and spaces
|
# Skip initial '#' comment and spaces
|
||||||
#for line in f:
|
#for line in f:
|
||||||
# if (not line.startswith('#')) and (not line.strip()):
|
# if (not line.startswith('#')) and (not line.strip()):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user