test/py: Use range() rather than xrange()
In python 3.x the xrange() function has been removed, and range()
returns an iterator much like Python 2.x's xrange(). Simply use range()
in place of xrange() in order to work on both python 2.x & 3.x. This
will mean a small cost on python 2.x since range() will return a list
there rather than an iterator, but the cost should be negligible.
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
diff --git a/test/py/u_boot_spawn.py b/test/py/u_boot_spawn.py
index 77a010a..b011a3e 100644
--- a/test/py/u_boot_spawn.py
+++ b/test/py/u_boot_spawn.py
@@ -134,7 +134,7 @@
the expected time.
"""
- for pi in xrange(len(patterns)):
+ for pi in range(len(patterns)):
if type(patterns[pi]) == type(''):
patterns[pi] = re.compile(patterns[pi])
@@ -143,7 +143,7 @@
while True:
earliest_m = None
earliest_pi = None
- for pi in xrange(len(patterns)):
+ for pi in range(len(patterns)):
pattern = patterns[pi]
m = pattern.search(self.buf)
if not m:
@@ -198,7 +198,7 @@
"""
os.close(self.fd)
- for i in xrange(100):
+ for i in range(100):
if not self.isalive():
break
time.sleep(0.1)