diff options
| author | cclauss <cclauss@bluewin.ch> | 2018-12-03 09:57:54 +0100 |
|---|---|---|
| committer | Rich Trott <rtrott@gmail.com> | 2018-12-06 19:21:30 -0800 |
| commit | 87592d1c48cde271eccc92ff31d4a5e7e6f4fb4e (patch) | |
| tree | 18b759a096add0983c68f3f8a8dfc0f3ce64c122 /test/message | |
| parent | ae3ee28abd0c794ec7782831f50578374eececb5 (diff) | |
| download | node-new-87592d1c48cde271eccc92ff31d4a5e7e6f4fb4e.tar.gz | |
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>
Diffstat (limited to 'test/message')
| -rw-r--r-- | test/message/testcfg.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/test/message/testcfg.py b/test/message/testcfg.py index 62776bcb7a..a4f802f3ef 100644 --- a/test/message/testcfg.py +++ b/test/message/testcfg.py @@ -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()): |
