[Piglit] [PATCH 03/44] python: use six.moves.range
baker.dylan.c at gmail.com
baker.dylan.c at gmail.com
Wed Jan 27 16:06:11 PST 2016
From: Dylan Baker <baker.dylan.c at gmail.com>
This is xrange on python 2.x and range on 3.x
Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
framework/test/base.py | 4 +++-
tests/all.py | 4 +++-
unittests/summary_common_tests.py | 3 ++-
3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/framework/test/base.py b/framework/test/base.py
index faad043..43f81c4 100644
--- a/framework/test/base.py
+++ b/framework/test/base.py
@@ -34,6 +34,8 @@ import copy
import signal
import warnings
+from six.moves import range
+
try:
# subprocess32 only supports *nix systems, this is important because
# "start_new_session" is not a valid argument on windows
@@ -341,7 +343,7 @@ class WindowResizeMixin(object):
Test.run() to return early.
"""
- for _ in xrange(5):
+ for _ in range(5):
super(WindowResizeMixin, self)._run_command()
if "Got spurious window resize" not in self.result.out:
return
diff --git a/tests/all.py b/tests/all.py
index 83ad945..c49dede 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -6,6 +6,8 @@ import itertools
import os
import platform
+from six.moves import range
+
from framework import grouptools
from framework.profile import TestProfile
from framework.test import (PiglitGLTest, GleanTest, ShaderTest,
@@ -2076,7 +2078,7 @@ with profile.group_manager(
for stage, type_, comp, sampler in itertools.product(
stages, types, comps, samplers):
for func in ['textureGather'] if 'Cube' in sampler else ['textureGather', 'textureGatherOffset', 'textureGatherOffsets']:
- for cs in xrange(len(comp)):
+ for cs in range(len(comp)):
assert cs <= 3
address_mode = 'clamp' if sampler == '2DRect' else 'repeat'
cmd = ['textureGather', stage,
diff --git a/unittests/summary_common_tests.py b/unittests/summary_common_tests.py
index 93fecaf..041961f 100644
--- a/unittests/summary_common_tests.py
+++ b/unittests/summary_common_tests.py
@@ -25,6 +25,7 @@ from __future__ import absolute_import, division, print_function
import datetime
import nose.tools as nt
+from six.moves import range
from framework import results, status, grouptools
from framework.summary import common as summary
@@ -245,7 +246,7 @@ class TestNamesSubtests(object):
def test_all(self):
"""summary.Names.all: Handles subtests as groups"""
baseline = {'foo', 'bar', 'oink', 'bonk', 'oink', 'tonk'}
- for x in xrange(1, 6):
+ for x in range(1, 6):
baseline.add(grouptools.join('bor', str(x)))
nt.eq_(self.test.names.all, baseline)
--
2.7.0
More information about the Piglit
mailing list