]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Use python3 compatible range operation
authorMasashi Honma <masashi.honma@gmail.com>
Thu, 24 Jan 2019 07:45:44 +0000 (16:45 +0900)
committerJouni Malinen <j@w1.fi>
Sat, 26 Jan 2019 10:56:02 +0000 (12:56 +0200)
This patch is made by using 2to3 command.

$ find . -name *.py | xargs 2to3 -f xrange -w -n

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
tests/hwsim/hwsim_utils.py
tests/hwsim/rfkill.py
tests/hwsim/test_wmediumd.py

index 8ad08fcd57671e60948fe8cf9af86b3a59db4dd4..cf49b13b13893e968623dc9d252f99e8532e37e5 100644 (file)
@@ -83,7 +83,7 @@ def run_connectivity_test(dev1, dev2, tos, dev1group=False, dev2group=False,
             cmd = "DATA_TEST_TX ff:ff:ff:ff:ff:ff {} {}".format(addr1, tos)
             if send_len is not None:
                 cmd += " len=" + str(send_len)
-            for i in xrange(broadcast_retry_c):
+            for i in range(broadcast_retry_c):
                 try:
                     if dev1group:
                         dev1.group_request(cmd)
@@ -135,7 +135,7 @@ def run_connectivity_test(dev1, dev2, tos, dev1group=False, dev2group=False,
             cmd = "DATA_TEST_TX ff:ff:ff:ff:ff:ff {} {}".format(addr2, tos)
             if send_len is not None:
                 cmd += " len=" + str(send_len)
-            for i in xrange(broadcast_retry_c):
+            for i in range(broadcast_retry_c):
                 try:
                     if dev2group:
                         dev2.group_request(cmd)
@@ -221,7 +221,7 @@ def test_connectivity_p2p_sta(dev1, dev2, dscp=None, tos=None):
 def test_connectivity_sta(dev1, dev2, dscp=None, tos=None):
     test_connectivity(dev1, dev2, dscp, tos)
 
-(PS_DISABLED, PS_ENABLED, PS_AUTO_POLL, PS_MANUAL_POLL) = range(4)
+(PS_DISABLED, PS_ENABLED, PS_AUTO_POLL, PS_MANUAL_POLL) = list(range(4))
 
 def set_powersave(dev, val):
     phy = dev.get_driver_status_field("phyname")
index fa724ae50c2ede70d66d4fa3d2b705ead5bf34ec..a5e6f523aa51459d48db6f80b0f0f32b7e759d3e 100755 (executable)
@@ -21,12 +21,12 @@ import os
  TYPE_WWAN,
  TYPE_GPS,
  TYPE_FM,
- TYPE_NFC) = range(9)
+ TYPE_NFC) = list(range(9))
 
 (_OP_ADD,
  _OP_DEL,
  _OP_CHANGE,
- _OP_CHANGE_ALL) = range(4)
+ _OP_CHANGE_ALL) = list(range(4))
 
 _type_names = {
     TYPE_ALL: "all",
index 26a7521e7cd790c85b07da4ca9a545783b38e22a..f17a02776ce7927cc7469b6709881e381e6ec33a 100644 (file)
@@ -368,7 +368,7 @@ def test_wmediumd_path_rann(dev, apdev, params):
         raise Exception("No captured data found\n")
     lines = out.splitlines()
     prev = float(lines[len(lines) - 1])
-    for i in reversed(range(1, len(lines) - 1)):
+    for i in reversed(list(range(1, len(lines) - 1))):
         now = float(lines[i])
         if prev - now < 1.0 or 3.0 < prev - now:
             raise Exception("RANN interval " + str(prev - now) +