tests: Python coding style cleanup (pylint3 bad-whitespace)

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Jouni Malinen 2019-03-15 12:10:37 +02:00 committed by Jouni Malinen
parent 009b54bedd
commit fab49f6145
102 changed files with 7660 additions and 7645 deletions

View File

@ -1704,7 +1704,8 @@ def test_ap_hs20_req_roaming_consortium(dev, apdev):
dev[0].set_cred(id, "required_roaming_consortium", "112233")
dev[0].set_cred(id, "required_roaming_consortium", "112233445566778899aabbccddeeff")
for val in [ "", "1", "11", "1122", "1122334", "112233445566778899aabbccddeeff00" ]:
for val in ["", "1", "11", "1122", "1122334",
"112233445566778899aabbccddeeff00"]:
if "FAIL" not in dev[0].request('SET_CRED {} required_roaming_consortium {}'.format(id, val)):
raise Exception("Invalid roaming consortium value accepted: " + val)
@ -3090,7 +3091,8 @@ def test_ap_hs20_fetch_osu_no_icon(dev, apdev):
params['osu_method_list'] = "1"
params['osu_friendly_name'] = ["eng:Test OSU", "fin:Testi-OSU"]
params['osu_icon'] = "w1fi_logo"
params['osu_service_desc'] = [ "eng:Example services", "fin:Esimerkkipalveluja" ]
params['osu_service_desc'] = ["eng:Example services",
"fin:Esimerkkipalveluja"]
params['osu_server_uri'] = "https://example.com/osu/"
hostapd.add_ap(apdev[0], params)
@ -3128,7 +3130,8 @@ def test_ap_hs20_fetch_osu_single_ssid(dev, apdev):
params['osu_friendly_name'] = ["eng:Test OSU", "fin:Testi-OSU"]
params['osu_nai2'] = "osen@example.com"
params['osu_icon'] = "w1fi_logo"
params['osu_service_desc'] = [ "eng:Example services", "fin:Esimerkkipalveluja" ]
params['osu_service_desc'] = ["eng:Example services",
"fin:Esimerkkipalveluja"]
params['osu_server_uri'] = "https://example.com/osu/"
params['wpa_key_mgmt'] = "WPA-EAP OSEN"
hostapd.add_ap(apdev[0], params)
@ -3190,7 +3193,8 @@ def test_ap_hs20_fetch_osu_single_ssid2(dev, apdev):
params['osu_friendly_name'] = ["eng:Test OSU", "fin:Testi-OSU"]
params['osu_nai2'] = "osen@example.com"
params['osu_icon'] = "w1fi_logo"
params['osu_service_desc'] = [ "eng:Example services", "fin:Esimerkkipalveluja" ]
params['osu_service_desc'] = ["eng:Example services",
"fin:Esimerkkipalveluja"]
params['osu_server_uri'] = "https://example.com/osu/"
params['wpa_key_mgmt'] = "WPA-EAP OSEN"
hapd = hostapd.add_ap(apdev[0], params, no_enable=True)
@ -3277,7 +3281,8 @@ def test_ap_hs20_req_hs20_icon(dev, apdev):
params['osu_method_list'] = "1"
params['osu_friendly_name'] = ["eng:Test OSU", "fin:Testi-OSU"]
params['osu_icon'] = ["w1fi_logo", "w1fi_logo2"]
params['osu_service_desc'] = [ "eng:Example services", "fin:Esimerkkipalveluja" ]
params['osu_service_desc'] = ["eng:Example services",
"fin:Esimerkkipalveluja"]
params['osu_server_uri'] = "https://example.com/osu/"
hostapd.add_ap(apdev[0], params)
@ -3380,7 +3385,8 @@ def test_ap_hs20_req_hs20_icon_oom(dev, apdev):
params['osu_method_list'] = "1"
params['osu_friendly_name'] = ["eng:Test OSU", "fin:Testi-OSU"]
params['osu_icon'] = ["w1fi_logo", "w1fi_logo2"]
params['osu_service_desc'] = [ "eng:Example services", "fin:Esimerkkipalveluja" ]
params['osu_service_desc'] = ["eng:Example services",
"fin:Esimerkkipalveluja"]
params['osu_server_uri'] = "https://example.com/osu/"
hostapd.add_ap(apdev[0], params)
@ -3432,7 +3438,8 @@ def test_ap_hs20_req_hs20_icon_parallel(dev, apdev):
params['osu_method_list'] = "1"
params['osu_friendly_name'] = ["eng:Test OSU", "fin:Testi-OSU"]
params['osu_icon'] = ["w1fi_logo", "w1fi_logo2"]
params['osu_service_desc'] = [ "eng:Example services", "fin:Esimerkkipalveluja" ]
params['osu_service_desc'] = ["eng:Example services",
"fin:Esimerkkipalveluja"]
params['osu_server_uri'] = "https://example.com/osu/"
hostapd.add_ap(apdev[0], params)
@ -3483,7 +3490,8 @@ def test_ap_hs20_fetch_osu_stop(dev, apdev):
params['osu_method_list'] = "1"
params['osu_friendly_name'] = ["eng:Test OSU", "fin:Testi-OSU"]
params['osu_icon'] = "w1fi_logo"
params['osu_service_desc'] = [ "eng:Example services", "fin:Esimerkkipalveluja" ]
params['osu_service_desc'] = ["eng:Example services",
"fin:Esimerkkipalveluja"]
params['osu_server_uri'] = "https://example.com/osu/"
hapd = hostapd.add_ap(apdev[0], params)
@ -3651,7 +3659,8 @@ def test_ap_hs20_fetch_osu_invalid_dir(dev, apdev):
params['osu_method_list'] = "1"
params['osu_friendly_name'] = ["eng:Test OSU", "fin:Testi-OSU"]
params['osu_icon'] = "w1fi_logo"
params['osu_service_desc'] = [ "eng:Example services", "fin:Esimerkkipalveluja" ]
params['osu_service_desc'] = ["eng:Example services",
"fin:Esimerkkipalveluja"]
params['osu_server_uri'] = "https://example.com/osu/"
hostapd.add_ap(apdev[0], params)
@ -3674,7 +3683,8 @@ def test_ap_hs20_fetch_osu_oom(dev, apdev):
params['osu_method_list'] = "1"
params['osu_friendly_name'] = ["eng:Test OSU", "fin:Testi-OSU"]
params['osu_icon'] = "w1fi_logo"
params['osu_service_desc'] = [ "eng:Example services", "fin:Esimerkkipalveluja" ]
params['osu_service_desc'] = ["eng:Example services",
"fin:Esimerkkipalveluja"]
params['osu_server_uri'] = "https://example.com/osu/"
hostapd.add_ap(apdev[0], params)

View File

@ -301,8 +301,7 @@ def test_ap_vht_20(devs, apdevs):
"vht_oper_chwidth": "0",
"vht_oper_centr_freq_seg0_idx": "0",
"supported_rates": "60 120 240 360 480 540",
"require_vht": "1",
}
"require_vht": "1"}
hapd = hostapd.add_ap(ap, params)
dev.connect("test-vht20", scan_freq="5180", key_mgmt="NONE")
hwsim_utils.test_connectivity(dev, hapd)
@ -328,8 +327,7 @@ def test_ap_vht_40(devs, apdevs):
"ht_capab": "[HT40+]",
"vht_capab": "",
"vht_oper_chwidth": "0",
"vht_oper_centr_freq_seg0_idx": "0",
}
"vht_oper_centr_freq_seg0_idx": "0"}
hapd = hostapd.add_ap(ap, params)
dev.connect("test-vht40", scan_freq="5180", key_mgmt="NONE")
hwsim_utils.test_connectivity(dev, hapd)
@ -931,8 +929,7 @@ def test_ap_vht_on_24ghz(dev, apdev):
"vendor_vht": "1",
"vht_capab": "[MAX-MPDU-11454]",
"vht_oper_chwidth": "0",
"vht_oper_centr_freq_seg0_idx": "1"
}
"vht_oper_centr_freq_seg0_idx": "1"}
hapd = hostapd.add_ap(apdev[0], params)
try:
if "OK" not in dev[0].request("VENDOR_ELEM_ADD 13 dd1300904c0400bf0c3240820feaff0000eaff0000"):
@ -973,8 +970,7 @@ def test_prefer_vht40(dev, apdev):
"ht_capab": "[HT40+]",
"vht_capab": "",
"vht_oper_chwidth": "0",
"vht_oper_centr_freq_seg0_idx": "0",
}
"vht_oper_centr_freq_seg0_idx": "0"}
hapd2 = hostapd.add_ap(apdev[1], params)
bssid2 = apdev[1]['bssid']
@ -1128,8 +1124,7 @@ def test_ap_vht_40_fallback_to_20(devs, apdevs):
"ht_capab": "[HT40+][SHORT-GI-20][SHORT-GI-40][DSSS_CCK-40]",
"vht_capab": "[RXLDPC][SHORT-GI-80][TX-STBC-2BY1][RX-STBC1][MAX-MPDU-11454][MAX-A-MPDU-LEN-EXP7]",
"vht_oper_chwidth": "0",
"vht_oper_centr_freq_seg0_idx": "155",
}
"vht_oper_centr_freq_seg0_idx": "155"}
hapd = hostapd.add_ap(ap, params)
dev.connect("test-vht40", scan_freq="5805", key_mgmt="NONE")
dev.wait_regdom(country_ie=True)

View File

@ -1640,8 +1640,7 @@ def _test_ap_wps_er_cache_ap_settings(dev, apdev):
hapd.disable()
for i in range(2):
ev = dev[0].wait_event([ "WPS-ER-AP-REMOVE",
"CTRL-EVENT-DISCONNECTED" ],
ev = dev[0].wait_event(["WPS-ER-AP-REMOVE", "CTRL-EVENT-DISCONNECTED"],
timeout=15)
if ev is None:
raise Exception("AP removal or disconnection timed out")
@ -6632,7 +6631,8 @@ def test_wps_ext(dev, apdev):
mac_addr, m1_attrs[ATTR_ENROLLEE_NONCE],
r_nonce)
r_s1, r_s2, r_hash1, r_hash2 = wsc_dev_pw_hash(authkey, pin,
m1_attrs[ATTR_PUBLIC_KEY], e_pk)
m1_attrs[ATTR_PUBLIC_KEY],
e_pk)
logger.debug("Send M2 to STA")
m2, raw_m2_attrs = build_m2(authkey, raw_m1_attrs, eap_id,
@ -6729,7 +6729,8 @@ def wps_start_kwa(dev, apdev):
mac_addr, m1_attrs[ATTR_ENROLLEE_NONCE],
r_nonce)
r_s1, r_s2, r_hash1, r_hash2 = wsc_dev_pw_hash(authkey, pin,
m1_attrs[ATTR_PUBLIC_KEY], e_pk)
m1_attrs[ATTR_PUBLIC_KEY],
e_pk)
logger.debug("Send M2 to STA")
m2, raw_m2_attrs = build_m2(authkey, raw_m1_attrs, eap_id,
@ -6832,7 +6833,8 @@ def wps_run_cred_proto(dev, apdev, m8_cred, connect=False, no_connect=False):
mac_addr, m1_attrs[ATTR_ENROLLEE_NONCE],
r_nonce)
r_s1, r_s2, r_hash1, r_hash2 = wsc_dev_pw_hash(authkey, pin,
m1_attrs[ATTR_PUBLIC_KEY], e_pk)
m1_attrs[ATTR_PUBLIC_KEY],
e_pk)
logger.debug("Send M2 to STA")
m2, raw_m2_attrs = build_m2(authkey, raw_m1_attrs, eap_id,
@ -7034,7 +7036,8 @@ def test_wps_ext_proto_m2_no_public_key(dev, apdev):
mac_addr, m1_attrs[ATTR_ENROLLEE_NONCE],
r_nonce)
r_s1, r_s2, r_hash1, r_hash2 = wsc_dev_pw_hash(authkey, pin,
m1_attrs[ATTR_PUBLIC_KEY], e_pk)
m1_attrs[ATTR_PUBLIC_KEY],
e_pk)
logger.debug("Send M2 to STA")
m2, raw_m2_attrs = build_m2(authkey, raw_m1_attrs, eap_id,
@ -7072,7 +7075,8 @@ def test_wps_ext_proto_m2_invalid_public_key(dev, apdev):
mac_addr, m1_attrs[ATTR_ENROLLEE_NONCE],
r_nonce)
r_s1, r_s2, r_hash1, r_hash2 = wsc_dev_pw_hash(authkey, pin,
m1_attrs[ATTR_PUBLIC_KEY], e_pk)
m1_attrs[ATTR_PUBLIC_KEY],
e_pk)
logger.debug("Send M2 to STA")
m2, raw_m2_attrs = build_m2(authkey, raw_m1_attrs, eap_id,
@ -7110,7 +7114,8 @@ def test_wps_ext_proto_m2_public_key_oom(dev, apdev):
mac_addr, m1_attrs[ATTR_ENROLLEE_NONCE],
r_nonce)
r_s1, r_s2, r_hash1, r_hash2 = wsc_dev_pw_hash(authkey, pin,
m1_attrs[ATTR_PUBLIC_KEY], e_pk)
m1_attrs[ATTR_PUBLIC_KEY],
e_pk)
logger.debug("Send M2 to STA")
m2, raw_m2_attrs = build_m2(authkey, raw_m1_attrs, eap_id,
@ -7149,7 +7154,8 @@ def test_wps_ext_proto_nack_m3(dev, apdev):
mac_addr, m1_attrs[ATTR_ENROLLEE_NONCE],
r_nonce)
r_s1, r_s2, r_hash1, r_hash2 = wsc_dev_pw_hash(authkey, pin,
m1_attrs[ATTR_PUBLIC_KEY], e_pk)
m1_attrs[ATTR_PUBLIC_KEY],
e_pk)
logger.debug("Send M2 to STA")
m2, raw_m2_attrs = build_m2(authkey, raw_m1_attrs, eap_id,
@ -7192,7 +7198,8 @@ def test_wps_ext_proto_nack_m5(dev, apdev):
mac_addr, m1_attrs[ATTR_ENROLLEE_NONCE],
r_nonce)
r_s1, r_s2, r_hash1, r_hash2 = wsc_dev_pw_hash(authkey, pin,
m1_attrs[ATTR_PUBLIC_KEY], e_pk)
m1_attrs[ATTR_PUBLIC_KEY],
e_pk)
logger.debug("Send M2 to STA")
m2, raw_m2_attrs = build_m2(authkey, raw_m1_attrs, eap_id,
@ -7251,7 +7258,8 @@ def wps_nack_m3(dev, apdev):
mac_addr, m1_attrs[ATTR_ENROLLEE_NONCE],
r_nonce)
r_s1, r_s2, r_hash1, r_hash2 = wsc_dev_pw_hash(authkey, pin,
m1_attrs[ATTR_PUBLIC_KEY], e_pk)
m1_attrs[ATTR_PUBLIC_KEY],
e_pk)
logger.debug("Send M2 to STA")
m2, raw_m2_attrs = build_m2(authkey, raw_m1_attrs, eap_id,
@ -7446,7 +7454,8 @@ def wps_to_m3_helper(dev, apdev):
mac_addr, m1_attrs[ATTR_ENROLLEE_NONCE],
r_nonce)
r_s1, r_s2, r_hash1, r_hash2 = wsc_dev_pw_hash(authkey, pin,
m1_attrs[ATTR_PUBLIC_KEY], e_pk)
m1_attrs[ATTR_PUBLIC_KEY],
e_pk)
logger.debug("Send M2 to STA")
m2, raw_m2_attrs = build_m2(authkey, raw_m1_attrs, eap_id,

View File

@ -131,8 +131,7 @@ def test_cfg80211_wep_key_idx_change(dev, apdev):
@remote_compatible
def test_cfg80211_hostapd_ext_sta_remove(dev, apdev):
"""cfg80211 DEL_STATION issued externally to hostapd"""
hapd = hostapd.add_ap(apdev[0],
{ "ssid": "open" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
id = dev[0].connect("open", key_mgmt="NONE", scan_freq="2412")
ifindex = int(hapd.get_driver_status_field("ifindex"))

View File

@ -2703,9 +2703,9 @@ def test_dbus_p2p_invalid(dev, apdev):
tests = [{'DiscoveryType': 'foo'},
{'RequestedDeviceTypes': 'foo'},
{'RequestedDeviceTypes': ['foo']},
{'RequestedDeviceTypes': ['1','2','3','4','5','6','7','8','9',
'10','11','12','13','14','15','16',
'17']},
{'RequestedDeviceTypes': ['1', '2', '3', '4', '5', '6', '7', '8',
'9', '10', '11', '12', '13', '14', '15',
'16', '17']},
{'RequestedDeviceTypes': dbus.Array([], signature="s")},
{'RequestedDeviceTypes': dbus.Array([['foo']], signature="as")},
{'RequestedDeviceTypes': dbus.Array([], signature="i")},
@ -2905,7 +2905,8 @@ def test_dbus_p2p_oom(dev, apdev):
with alloc_fail_dbus(dev[0], 10, "_wpa_dbus_dict_entry_get_string_array",
"Find", "InvalidArgs"):
p2p.Find(dbus.Dictionary({ 'Foo': [ '1','2','3','4','5','6','7','8','9' ] }))
p2p.Find(dbus.Dictionary({'Foo': ['1', '2', '3', '4', '5', '6', '7',
'8', '9']}))
with alloc_fail_dbus(dev[0], 1, ":=_wpa_dbus_dict_entry_get_binarray",
"Find", "InvalidArgs"):

View File

@ -235,8 +235,7 @@ def run_macsec_psk(dev, apdev, params, prefix, integ_only=False, port0=None,
cap_macsec1 = os.path.join(params['logdir'], prefix + ".macsec1.pcap")
for i in range(2):
subprocess.check_call([ "ip", "link", "set", "dev", "veth%d" % i,
"up" ])
subprocess.check_call(["ip", "link", "set", "dev", "veth%d" % i, "up"])
cmd = {}
cmd[0] = subprocess.Popen(['tcpdump', '-p', '-U', '-i', 'veth0',

View File

@ -152,7 +152,8 @@ def test_persistent_group_per_sta_psk(dev):
dev[2].dump_monitor()
peer = dev[2].get_peer(addr0)
dev[2].global_request("P2P_GROUP_ADD persistent=" + peer['persistent'] + " freq=2412")
ev = dev[2].wait_global_event(["P2P-GROUP-STARTED","WPA: 4-Way Handshake failed"], timeout=30)
ev = dev[2].wait_global_event(["P2P-GROUP-STARTED",
"WPA: 4-Way Handshake failed"], timeout=30)
if ev is None:
raise Exception("Timeout on group restart (on client)")
if "P2P-GROUP-STARTED" not in ev:
@ -168,7 +169,8 @@ def test_persistent_group_per_sta_psk(dev):
dev[2].dump_monitor()
peer = dev[2].get_peer(addr0)
dev[2].global_request("P2P_GROUP_ADD persistent=" + peer['persistent'] + " freq=2412")
ev = dev[2].wait_global_event(["P2P-GROUP-STARTED","WPA: 4-Way Handshake failed"], timeout=30)
ev = dev[2].wait_global_event(["P2P-GROUP-STARTED",
"WPA: 4-Way Handshake failed"], timeout=30)
if ev is None:
raise Exception("Timeout on group restart (on client)")
if "P2P-GROUP-STARTED" in ev:
@ -192,7 +194,8 @@ def test_persistent_group_per_sta_psk(dev):
dev[1].global_request("P2P_INVITE persistent=" + peer['persistent'] + " peer=" + addr0)
ev = dev[0].wait_global_event(["P2P-GROUP-STARTED"], timeout=30)
dev[0].group_form_result(ev)
ev = dev[1].wait_global_event(["P2P-GROUP-STARTED","WPA: 4-Way Handshake failed"], timeout=30)
ev = dev[1].wait_global_event(["P2P-GROUP-STARTED",
"WPA: 4-Way Handshake failed"], timeout=30)
if ev is None:
raise Exception("Timeout on group restart (on client)")
if "P2P-GROUP-STARTED" in ev:

View File

@ -409,8 +409,7 @@ def main():
tests = args.params
else:
tests = []
cmd = [ os.path.join(os.path.dirname(scriptsdir), 'run-tests.py'),
'-L' ]
cmd = [os.path.join(os.path.dirname(scriptsdir), 'run-tests.py'), '-L']
if args.testmodules:
cmd += ["-f"]
cmd += args.testmodules