From 6028f70a0a3c8b8ce527e682d9284f68dce9e091 Mon Sep 17 00:00:00 2001
From: cclauss <cclauss@bluewin.ch>
Date: Mon, 3 Dec 2018 00:02:37 +0100
Subject: [PATCH] test: prepare test/pseudo-tty/testcfg.py for Python 3

PR-URL: https://github.com/nodejs/node/pull/24791
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
---
 test/pseudo-tty/testcfg.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/test/pseudo-tty/testcfg.py b/test/pseudo-tty/testcfg.py
index 9289ce4f10d33a..85b304b09c0a81 100644
--- a/test/pseudo-tty/testcfg.py
+++ b/test/pseudo-tty/testcfg.py
@@ -32,6 +32,11 @@
 import re
 import utils
 
+try:
+  xrange          # Python 2
+except NameError:
+  xrange = range  # Python 3
+
 FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)")
 
 class TTYTestCase(test.TestCase):
@@ -51,7 +56,7 @@ def IgnoreLine(self, str):
     else: return str.startswith('==') or str.startswith('**')
 
   def IsFailureOutput(self, output):
-    f = file(self.expected)
+    f = open(self.expected)
     # Convert output lines to regexps that we can match
     env = { 'basename': basename(self.file) }
     patterns = [ ]