]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: python3 compatible str/bytes ord()
authorJouni Malinen <j@w1.fi>
Sun, 3 Feb 2019 10:44:17 +0000 (12:44 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 4 Feb 2019 10:26:34 +0000 (12:26 +0200)
Need to skip ord() for python3 when going through bytes object (instead
of str object in python2).

Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/test_wpas_wmm_ac.py

index 94c540b241f00f87ca6abd2fecd08413c8ce5b8e..6a3ee807fcbf4f9a8eeb7956d1ce5bb909ec7481 100644 (file)
@@ -8,6 +8,7 @@ from remotehost import remote_compatible
 import logging
 logger = logging.getLogger()
 import struct
+import sys
 
 import hwsim_utils
 import hostapd
@@ -201,7 +202,8 @@ def test_tspec_protocol(dev, apdev):
     msg['sa'] = apdev[0]['bssid']
 
     # modified parameters
-    msg['payload'] = struct.pack('BBBB', 17, 1, dialog, 1) + payload[4:12] + struct.pack('B', ord(payload[12]) & ~0x60) + payload[13:]
+    p12int = payload[12] if sys.version_info[0] > 2 else ord(payload[12])
+    msg['payload'] = struct.pack('BBBB', 17, 1, dialog, 1) + payload[4:12] + struct.pack('B', p12int & ~0x60) + payload[13:]
     hapd.mgmt_tx(msg)
 
     # reject request