diff options
Diffstat (limited to 'tests/hwsim/test_dbus.py')
-rw-r--r-- | tests/hwsim/test_dbus.py | 234 |
1 files changed, 117 insertions, 117 deletions
diff --git a/tests/hwsim/test_dbus.py b/tests/hwsim/test_dbus.py index 3baca4c..e0703fa 100644 --- a/tests/hwsim/test_dbus.py +++ b/tests/hwsim/test_dbus.py @@ -51,7 +51,7 @@ def prepare_dbus(dev): path = wpas.GetInterface(dev.ifname) if_obj = bus.get_object(WPAS_DBUS_SERVICE, path) return (bus,wpas_obj,path,if_obj) - except Exception, e: + except Exception as e: raise HwsimSkip("Could not connect to D-Bus: %s" % e) class TestDbus(object): @@ -182,7 +182,7 @@ def test_dbus_getall_oom(dev, apdev): try: props = net_obj.GetAll(WPAS_DBUS_NETWORK, dbus_interface=dbus.PROPERTIES_IFACE) - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: pass def dbus_get(dbus, wpas_obj, prop, expect=None, byte_arrays=False): @@ -210,7 +210,7 @@ def test_dbus_properties(dev, apdev): try: dbus_set(dbus, wpas_obj, "DebugLevel", val) raise Exception("Invalid DebugLevel value accepted: " + str(val)) - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if err not in str(e): raise Exception("Unexpected error message: " + str(e)) dbus_set(dbus, wpas_obj, "DebugLevel", "msgdump") @@ -222,7 +222,7 @@ def test_dbus_properties(dev, apdev): try: dbus_set(dbus, wpas_obj, "DebugTimestamp", "foo") raise Exception("Invalid DebugTimestamp value accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "Error.Failed: wrong property type" not in str(e): raise Exception("Unexpected error message: " + str(e)) dbus_set(dbus, wpas_obj, "DebugTimestamp", True) @@ -234,7 +234,7 @@ def test_dbus_properties(dev, apdev): try: dbus_set(dbus, wpas_obj, "DebugShowKeys", "foo") raise Exception("Invalid DebugShowKeys value accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "Error.Failed: wrong property type" not in str(e): raise Exception("Unexpected error message: " + str(e)) dbus_set(dbus, wpas_obj, "DebugShowKeys", True) @@ -261,7 +261,7 @@ def test_dbus_properties(dev, apdev): try: dbus_set(dbus, wpas_obj, "WFDIEs", dbus.ByteArray('\x00')) raise Exception("Invalid WFDIEs value accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e): raise Exception("Unexpected error message: " + str(e)) dbus_set(dbus, wpas_obj, "WFDIEs", dbus.ByteArray('')) @@ -275,7 +275,7 @@ def test_dbus_properties(dev, apdev): try: dbus_set(dbus, wpas_obj, "EapMethods", res) raise Exception("Invalid Set accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs: Property is read-only" not in str(e): raise Exception("Unexpected error message: " + str(e)) @@ -283,7 +283,7 @@ def test_dbus_properties(dev, apdev): wpas_obj.SetFoo(WPAS_DBUS_SERVICE, "DebugShowKeys", True, dbus_interface=dbus.PROPERTIES_IFACE) raise Exception("Unknown method accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "UnknownMethod" not in str(e): raise Exception("Unexpected error message: " + str(e)) @@ -291,7 +291,7 @@ def test_dbus_properties(dev, apdev): wpas_obj.Get("foo", "DebugShowKeys", dbus_interface=dbus.PROPERTIES_IFACE) raise Exception("Invalid Get accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs: No such property" not in str(e): raise Exception("Unexpected error message: " + str(e)) @@ -301,14 +301,14 @@ def test_dbus_properties(dev, apdev): test_obj.Get(123, "DebugShowKeys", dbus_interface=dbus.PROPERTIES_IFACE) raise Exception("Invalid Get accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs: Invalid arguments" not in str(e): raise Exception("Unexpected error message: " + str(e)) try: test_obj.Get(WPAS_DBUS_SERVICE, 123, dbus_interface=dbus.PROPERTIES_IFACE) raise Exception("Invalid Get accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs: Invalid arguments" not in str(e): raise Exception("Unexpected error message: " + str(e)) @@ -317,7 +317,7 @@ def test_dbus_properties(dev, apdev): dbus.ByteArray('', variant_level=2), dbus_interface=dbus.PROPERTIES_IFACE) raise Exception("Invalid Set accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs: invalid message format" not in str(e): raise Exception("Unexpected error message: " + str(e)) @@ -351,7 +351,7 @@ def test_dbus_invalid_method(dev, apdev): try: wps.Foo() raise Exception("Unknown method accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "UnknownMethod" not in str(e): raise Exception("Unexpected error message: " + str(e)) @@ -360,7 +360,7 @@ def test_dbus_invalid_method(dev, apdev): try: test_wps.Start(123) raise Exception("WPS.Start with incorrect signature accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs: Invalid arg" not in str(e): raise Exception("Unexpected error message: " + str(e)) @@ -537,7 +537,7 @@ def test_dbus_wps_invalid(dev, apdev): try: wps.Start(args) raise Exception("Invalid WPS.Start() arguments accepted: " + str(args)) - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if not str(e).startswith("fi.w1.wpa_supplicant1.InvalidArgs"): raise Exception("Unexpected error message: " + str(e)) @@ -571,7 +571,7 @@ def test_dbus_wps_oom(dev, apdev): try: bss_obj.Get(WPAS_DBUS_BSS, "Rates", dbus_interface=dbus.PROPERTIES_IFACE) - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: pass id = dev[0].add_network() @@ -1031,7 +1031,7 @@ def test_dbus_scan_invalid(dev, apdev): try: iface.Scan(t) raise Exception("Invalid Scan() arguments accepted: " + str(t)) - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if err not in str(e): raise Exception("Unexpected error message for invalid Scan(%s): %s" % (str(t), str(e))) @@ -1162,7 +1162,7 @@ def test_dbus_scan_busy(dev, apdev): try: iface.Scan({'Type': 'active', 'AllowRoam': False}) raise Exception("Scan() accepted when busy") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "ScanError: Scan request reject" not in str(e): raise Exception("Unexpected error message: " + str(e)) @@ -1436,13 +1436,13 @@ def test_dbus_connect_oom(dev, apdev): signature='sv') try: self.netw = iface.AddNetwork(args) - except Exception, e: + except Exception as e: logger.info("Exception on AddNetwork: " + str(e)) self.loop.quit() return False try: iface.SelectNetwork(self.netw) - except Exception, e: + except Exception as e: logger.info("Exception on SelectNetwork: " + str(e)) self.loop.quit() @@ -1499,14 +1499,14 @@ def test_dbus_while_not_connected(dev, apdev): try: iface.Disconnect() raise Exception("Disconnect() accepted when not connected") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "NotConnected" not in str(e): raise Exception("Unexpected error message for invalid Disconnect: " + str(e)) try: iface.Reattach() raise Exception("Reattach() accepted when not connected") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "NotConnected" not in str(e): raise Exception("Unexpected error message for invalid Reattach: " + str(e)) @@ -1661,13 +1661,13 @@ def test_dbus_network(dev, apdev): try: iface.RemoveNetwork(netw) raise Exception("Invalid RemoveNetwork() accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "NetworkUnknown" not in str(e): raise Exception("Unexpected error message for invalid RemoveNetwork: " + str(e)) try: iface.SelectNetwork(netw) raise Exception("Invalid SelectNetwork() accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "NetworkUnknown" not in str(e): raise Exception("Unexpected error message for invalid RemoveNetwork: " + str(e)) @@ -1704,7 +1704,7 @@ def test_dbus_network(dev, apdev): net_obj.Set(WPAS_DBUS_NETWORK, "Enabled", dbus.UInt32(1), dbus_interface=dbus.PROPERTIES_IFACE) raise Exception("Invalid Set(Enabled,1) accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "Error.Failed: wrong property type" not in str(e): raise Exception("Unexpected error message for invalid Set(Enabled,1): " + str(e)) @@ -1734,7 +1734,7 @@ def test_dbus_network(dev, apdev): try: iface.AddNetwork(args) raise Exception("Invalid AddNetwork args accepted: " + str(args)) - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e): raise Exception("Unexpected error message for invalid AddNetwork: " + str(e)) @@ -1770,7 +1770,7 @@ def test_dbus_network_oom(dev, apdev): # Currently, AddNetwork() succeeds even if os_strdup() for path # fails, so remove the network if that occurs. iface.RemoveNetwork(netw) - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: pass for i in range(1, 3): @@ -1780,7 +1780,7 @@ def test_dbus_network_oom(dev, apdev): # Currently, AddNetwork() succeeds even if network registration # fails, so remove the network if that occurs. iface.RemoveNetwork(netw) - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: pass with alloc_fail_dbus(dev[0], 1, @@ -1857,7 +1857,7 @@ def _test_dbus_interface(dev, apdev): try: wpas.CreateInterface(params) raise Exception("Invalid CreateInterface() accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InterfaceExists" not in str(e): raise Exception("Unexpected error message for invalid CreateInterface: " + str(e)) @@ -1865,7 +1865,7 @@ def _test_dbus_interface(dev, apdev): try: wpas.RemoveInterface(path) raise Exception("Invalid RemoveInterface() accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InterfaceUnknown" not in str(e): raise Exception("Unexpected error message for invalid RemoveInterface: " + str(e)) @@ -1875,7 +1875,7 @@ def _test_dbus_interface(dev, apdev): try: wpas.CreateInterface(params) raise Exception("Invalid CreateInterface() accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e): raise Exception("Unexpected error message for invalid CreateInterface: " + str(e)) @@ -1883,14 +1883,14 @@ def _test_dbus_interface(dev, apdev): try: wpas.CreateInterface(params) raise Exception("Invalid CreateInterface() accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e): raise Exception("Unexpected error message for invalid CreateInterface: " + str(e)) try: wpas.GetInterface("lo") raise Exception("Invalid GetInterface() accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InterfaceUnknown" not in str(e): raise Exception("Unexpected error message for invalid RemoveInterface: " + str(e)) @@ -1920,7 +1920,7 @@ def test_dbus_interface_oom(dev, apdev): raise Exception("CreateInterface succeeded during out-of-memory") if not state.startswith('0:'): break - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: pass for arg in [ 'Driver', 'Ifname', 'ConfigFile', 'BridgeIfname' ]: @@ -1939,7 +1939,7 @@ def test_dbus_blob(dev, apdev): try: iface.AddBlob('blob1', dbus.ByteArray("\x01\x02\x04")) raise Exception("Invalid AddBlob() accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "BlobExists" not in str(e): raise Exception("Unexpected error message for invalid AddBlob: " + str(e)) res = iface.GetBlob('blob1') @@ -1956,13 +1956,13 @@ def test_dbus_blob(dev, apdev): try: iface.RemoveBlob('blob1') raise Exception("Invalid RemoveBlob() accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "BlobUnknown" not in str(e): raise Exception("Unexpected error message for invalid RemoveBlob: " + str(e)) try: iface.GetBlob('blob1') raise Exception("Invalid GetBlob() accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "BlobUnknown" not in str(e): raise Exception("Unexpected error message for invalid GetBlob: " + str(e)) @@ -2045,14 +2045,14 @@ def test_dbus_tdls_invalid(dev, apdev): try: iface.TDLSDiscover("foo") raise Exception("Invalid TDLSDiscover() accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e): raise Exception("Unexpected error message for invalid TDLSDiscover: " + str(e)) try: iface.TDLSStatus("foo") raise Exception("Invalid TDLSStatus() accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e): raise Exception("Unexpected error message for invalid TDLSStatus: " + str(e)) @@ -2063,35 +2063,35 @@ def test_dbus_tdls_invalid(dev, apdev): try: iface.TDLSSetup("foo") raise Exception("Invalid TDLSSetup() accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e): raise Exception("Unexpected error message for invalid TDLSSetup: " + str(e)) try: iface.TDLSTeardown("foo") raise Exception("Invalid TDLSTeardown() accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e): raise Exception("Unexpected error message for invalid TDLSTeardown: " + str(e)) try: iface.TDLSTeardown("00:11:22:33:44:55") raise Exception("TDLSTeardown accepted for unknown peer") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "UnknownError: error performing TDLS teardown" not in str(e): raise Exception("Unexpected error message: " + str(e)) try: iface.TDLSChannelSwitch({}) raise Exception("Invalid TDLSChannelSwitch() accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e): raise Exception("Unexpected error message for invalid TDLSChannelSwitch: " + str(e)) try: iface.TDLSCancelChannelSwitch("foo") raise Exception("Invalid TDLSCancelChannelSwitch() accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e): raise Exception("Unexpected error message for invalid TDLSCancelChannelSwitch: " + str(e)) @@ -2227,7 +2227,7 @@ def test_dbus_tdls_channel_switch(dev, apdev): signature='sv') try: iface.TDLSChannelSwitch(args) - except Exception, e: + except Exception as e: if "InvalidArgs" not in str(e): raise Exception("Unexpected exception") @@ -2235,7 +2235,7 @@ def test_dbus_tdls_channel_switch(dev, apdev): args = dbus.Dictionary({}, signature='sv') try: iface.TDLSChannelSwitch(args) - except Exception, e: + except Exception as e: if "InvalidArgs" not in str(e): raise Exception("Unexpected exception") @@ -2244,7 +2244,7 @@ def test_dbus_tdls_channel_switch(dev, apdev): signature='sv') try: iface.TDLSChannelSwitch(args) - except Exception, e: + except Exception as e: if "InvalidArgs" not in str(e): raise Exception("Unexpected exception") @@ -2254,7 +2254,7 @@ def test_dbus_tdls_channel_switch(dev, apdev): signature='sv') try: iface.TDLSChannelSwitch(args) - except Exception, e: + except Exception as e: if "InvalidArgs" not in str(e): raise Exception("Unexpected exception") @@ -2295,13 +2295,13 @@ def test_dbus_pkcs11(dev, apdev): try: iface.SetPKCS11EngineAndModulePath("foo", "bar") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "Error.Failed: Reinit of the EAPOL" not in str(e): raise Exception("Unexpected error message for invalid SetPKCS11EngineAndModulePath: " + str(e)) try: iface.SetPKCS11EngineAndModulePath("foo", "") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "Error.Failed: Reinit of the EAPOL" not in str(e): raise Exception("Unexpected error message for invalid SetPKCS11EngineAndModulePath: " + str(e)) @@ -2352,7 +2352,7 @@ def _test_dbus_apscan(dev, apdev): if_obj.Set(WPAS_DBUS_IFACE, "ApScan", dbus.Int16(-1), dbus_interface=dbus.PROPERTIES_IFACE) raise Exception("Invalid Set(ApScan,-1) accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "Error.Failed: wrong property type" not in str(e): raise Exception("Unexpected error message for invalid Set(ApScan,-1): " + str(e)) @@ -2360,7 +2360,7 @@ def _test_dbus_apscan(dev, apdev): if_obj.Set(WPAS_DBUS_IFACE, "ApScan", dbus.UInt32(123), dbus_interface=dbus.PROPERTIES_IFACE) raise Exception("Invalid Set(ApScan,123) accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "Error.Failed: ap_scan must be 0, 1, or 2" not in str(e): raise Exception("Unexpected error message for invalid Set(ApScan,123): " + str(e)) @@ -2415,7 +2415,7 @@ def test_dbus_fastreauth(dev, apdev): if_obj.Set(WPAS_DBUS_IFACE, "FastReauth", dbus.Int16(-1), dbus_interface=dbus.PROPERTIES_IFACE) raise Exception("Invalid Set(FastReauth,-1) accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "Error.Failed: wrong property type" not in str(e): raise Exception("Unexpected error message for invalid Set(ApScan,-1): " + str(e)) @@ -2444,7 +2444,7 @@ def test_dbus_bss_expire(dev, apdev): if_obj.Set(WPAS_DBUS_IFACE, "BSSExpireAge", dbus.Int16(-1), dbus_interface=dbus.PROPERTIES_IFACE) raise Exception("Invalid Set(BSSExpireAge,-1) accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "Error.Failed: wrong property type" not in str(e): raise Exception("Unexpected error message for invalid Set(BSSExpireAge,-1): " + str(e)) @@ -2452,7 +2452,7 @@ def test_dbus_bss_expire(dev, apdev): if_obj.Set(WPAS_DBUS_IFACE, "BSSExpireAge", dbus.UInt32(9), dbus_interface=dbus.PROPERTIES_IFACE) raise Exception("Invalid Set(BSSExpireAge,9) accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "Error.Failed: BSSExpireAge must be >= 10" not in str(e): raise Exception("Unexpected error message for invalid Set(BSSExpireAge,9): " + str(e)) @@ -2460,7 +2460,7 @@ def test_dbus_bss_expire(dev, apdev): if_obj.Set(WPAS_DBUS_IFACE, "BSSExpireCount", dbus.Int16(-1), dbus_interface=dbus.PROPERTIES_IFACE) raise Exception("Invalid Set(BSSExpireCount,-1) accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "Error.Failed: wrong property type" not in str(e): raise Exception("Unexpected error message for invalid Set(BSSExpireCount,-1): " + str(e)) @@ -2468,7 +2468,7 @@ def test_dbus_bss_expire(dev, apdev): if_obj.Set(WPAS_DBUS_IFACE, "BSSExpireCount", dbus.UInt32(0), dbus_interface=dbus.PROPERTIES_IFACE) raise Exception("Invalid Set(BSSExpireCount,0) accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "Error.Failed: BSSExpireCount must be > 0" not in str(e): raise Exception("Unexpected error message for invalid Set(BSSExpireCount,0): " + str(e)) @@ -2513,7 +2513,7 @@ def _test_dbus_country(dev, apdev): if_obj.Set(WPAS_DBUS_IFACE, "Country", dbus.Int16(-1), dbus_interface=dbus.PROPERTIES_IFACE) raise Exception("Invalid Set(Country,-1) accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "Error.Failed: wrong property type" not in str(e): raise Exception("Unexpected error message for invalid Set(Country,-1): " + str(e)) @@ -2521,7 +2521,7 @@ def _test_dbus_country(dev, apdev): if_obj.Set(WPAS_DBUS_IFACE, "Country", "F", dbus_interface=dbus.PROPERTIES_IFACE) raise Exception("Invalid Set(Country,F) accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "Error.Failed: invalid country code" not in str(e): raise Exception("Unexpected error message for invalid Set(Country,F): " + str(e)) @@ -2560,7 +2560,7 @@ def _test_dbus_scan_interval(dev, apdev): if_obj.Set(WPAS_DBUS_IFACE, "ScanInterval", dbus.UInt16(100), dbus_interface=dbus.PROPERTIES_IFACE) raise Exception("Invalid Set(ScanInterval,100) accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "Error.Failed: wrong property type" not in str(e): raise Exception("Unexpected error message for invalid Set(ScanInterval,100): " + str(e)) @@ -2568,7 +2568,7 @@ def _test_dbus_scan_interval(dev, apdev): if_obj.Set(WPAS_DBUS_IFACE, "ScanInterval", dbus.Int32(-1), dbus_interface=dbus.PROPERTIES_IFACE) raise Exception("Invalid Set(ScanInterval,-1) accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "Error.Failed: scan_interval must be >= 0" not in str(e): raise Exception("Unexpected error message for invalid Set(ScanInterval,-1): " + str(e)) @@ -2626,7 +2626,7 @@ def test_dbus_probe_req_reporting(dev, apdev): try: t.iface.UnsubscribeProbeReq() raise Exception("Invalid UnsubscribeProbeReq() accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "NoSubscription" not in str(e): raise Exception("Unexpected error message for invalid UnsubscribeProbeReq(): " + str(e)) t.group_p2p.Disconnect() @@ -2650,7 +2650,7 @@ def test_dbus_probe_req_reporting_oom(dev, apdev): try: iface.UnsubscribeProbeReq() was_subscribed = True - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: was_subscribed = False pass @@ -2671,14 +2671,14 @@ def test_dbus_p2p_invalid(dev, apdev): try: p2p.RejectPeer(path + "/Peers/00112233445566") raise Exception("Invalid RejectPeer accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "UnknownError: Failed to call wpas_p2p_reject" not in str(e): raise Exception("Unexpected error message for invalid RejectPeer(): " + str(e)) try: p2p.RejectPeer("/foo") raise Exception("Invalid RejectPeer accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e): raise Exception("Unexpected error message for invalid RejectPeer(): " + str(e)) @@ -2691,7 +2691,7 @@ def test_dbus_p2p_invalid(dev, apdev): try: p2p.RemoveClient(t) raise Exception("Invalid RemoveClient accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e): raise Exception("Unexpected error message for invalid RemoveClient(): " + str(e)) @@ -2717,7 +2717,7 @@ def test_dbus_p2p_invalid(dev, apdev): try: p2p.Find(dbus.Dictionary(t)) raise Exception("Invalid Find accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e): raise Exception("Unexpected error message for invalid Find(): " + str(e)) @@ -2727,7 +2727,7 @@ def test_dbus_p2p_invalid(dev, apdev): try: p2p.RemovePersistentGroup(dbus.ObjectPath(p)) raise Exception("Invalid RemovePersistentGroup accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e): raise Exception("Unexpected error message for invalid RemovePersistentGroup: " + str(e)) @@ -2735,7 +2735,7 @@ def test_dbus_p2p_invalid(dev, apdev): dev[0].request("P2P_SET disabled 1") p2p.Listen(5) raise Exception("Invalid Listen accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "UnknownError: Could not start P2P listen" not in str(e): raise Exception("Unexpected error message for invalid Listen: " + str(e)) finally: @@ -2746,7 +2746,7 @@ def test_dbus_p2p_invalid(dev, apdev): try: test_p2p.Listen("foo") raise Exception("Invalid Listen accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e): raise Exception("Unexpected error message for invalid Listen: " + str(e)) @@ -2754,7 +2754,7 @@ def test_dbus_p2p_invalid(dev, apdev): dev[0].request("P2P_SET disabled 1") p2p.ExtendedListen(dbus.Dictionary({})) raise Exception("Invalid ExtendedListen accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "UnknownError: failed to initiate a p2p_ext_listen" not in str(e): raise Exception("Unexpected error message for invalid ExtendedListen: " + str(e)) finally: @@ -2766,7 +2766,7 @@ def test_dbus_p2p_invalid(dev, apdev): 'duration2': 20000, 'interval2': 102400 } p2p.PresenceRequest(args) raise Exception("Invalid PresenceRequest accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "UnknownError: Failed to invoke presence request" not in str(e): raise Exception("Unexpected error message for invalid PresenceRequest: " + str(e)) finally: @@ -2776,7 +2776,7 @@ def test_dbus_p2p_invalid(dev, apdev): params = dbus.Dictionary({'frequency': dbus.Int32(-1)}) p2p.GroupAdd(params) raise Exception("Invalid GroupAdd accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e): raise Exception("Unexpected error message for invalid GroupAdd: " + str(e)) @@ -2786,14 +2786,14 @@ def test_dbus_p2p_invalid(dev, apdev): 'frequency': 2412}) p2p.GroupAdd(params) raise Exception("Invalid GroupAdd accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e): raise Exception("Unexpected error message for invalid GroupAdd: " + str(e)) try: p2p.Disconnect() raise Exception("Invalid Disconnect accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "UnknownError: failed to disconnect" not in str(e): raise Exception("Unexpected error message for invalid Disconnect: " + str(e)) @@ -2801,7 +2801,7 @@ def test_dbus_p2p_invalid(dev, apdev): dev[0].request("P2P_SET disabled 1") p2p.Flush() raise Exception("Invalid Flush accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "Error.Failed: P2P is not available for this interface" not in str(e): raise Exception("Unexpected error message for invalid Flush: " + str(e)) finally: @@ -2815,7 +2815,7 @@ def test_dbus_p2p_invalid(dev, apdev): 'frequency': 2412 } pin = p2p.Connect(args) raise Exception("Invalid Connect accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "Error.Failed: P2P is not available for this interface" not in str(e): raise Exception("Unexpected error message for invalid Connect: " + str(e)) finally: @@ -2828,7 +2828,7 @@ def test_dbus_p2p_invalid(dev, apdev): try: pin = p2p.Connect(args) raise Exception("Invalid Connect accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e): raise Exception("Unexpected error message for invalid Connect: " + str(e)) @@ -2837,7 +2837,7 @@ def test_dbus_p2p_invalid(dev, apdev): args = { 'peer': path } pin = p2p.Invite(args) raise Exception("Invalid Invite accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "Error.Failed: P2P is not available for this interface" not in str(e): raise Exception("Unexpected error message for invalid Invite: " + str(e)) finally: @@ -2847,7 +2847,7 @@ def test_dbus_p2p_invalid(dev, apdev): args = { 'foo': 'bar' } pin = p2p.Invite(args) raise Exception("Invalid Invite accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e): raise Exception("Unexpected error message for invalid Connect: " + str(e)) @@ -2870,7 +2870,7 @@ def test_dbus_p2p_invalid(dev, apdev): try: p2p.ProvisionDiscoveryRequest(p, method) raise Exception("Invalid ProvisionDiscoveryRequest accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if err not in str(e): raise Exception("Unexpected error message for invalid ProvisionDiscoveryRequest: " + str(e)) @@ -2879,7 +2879,7 @@ def test_dbus_p2p_invalid(dev, apdev): if_obj.Get(WPAS_DBUS_IFACE_P2PDEVICE, "Peers", dbus_interface=dbus.PROPERTIES_IFACE) raise Exception("Invalid Get(Peers) accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "Error.Failed: P2P is not available for this interface" not in str(e): raise Exception("Unexpected error message for invalid Get(Peers): " + str(e)) finally: @@ -3075,7 +3075,7 @@ def run_dbus_p2p_discovery(dev, apdev): try: p2p.RejectPeer(path) raise Exception("Invalid RejectPeer accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "UnknownError: Failed to call wpas_p2p_reject" not in str(e): raise Exception("Unexpected error message for invalid RejectPeer(): " + str(e)) self.loop.quit() @@ -3121,7 +3121,7 @@ def run_dbus_p2p_discovery(dev, apdev): try: p2p.ExtendedListen(dbus.Dictionary({'foo': 100})) raise Exception("Invalid ExtendedListen accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e): raise Exception("Unexpected error message for invalid ExtendedListen(): " + str(e)) @@ -3191,7 +3191,7 @@ def test_dbus_p2p_service_discovery(dev, apdev): try: p2p.DeleteService(args) raise Exception("Invalid DeleteService() accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e): raise Exception("Unexpected error message for invalid DeleteService(): " + str(e)) @@ -3201,7 +3201,7 @@ def test_dbus_p2p_service_discovery(dev, apdev): try: p2p.DeleteService(args) raise Exception("Invalid DeleteService() accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e): raise Exception("Unexpected error message for invalid DeleteService(): " + str(e)) @@ -3213,7 +3213,7 @@ def test_dbus_p2p_service_discovery(dev, apdev): try: p2p.DeleteService(args) raise Exception("Invalid DeleteService() accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e): raise Exception("Unexpected error message for invalid DeleteService(): " + str(e)) @@ -3233,7 +3233,7 @@ def test_dbus_p2p_service_discovery(dev, apdev): try: p2p.DeleteService(args) raise Exception("Invalid DeleteService() accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e): raise Exception("Unexpected error message for invalid DeleteService(): " + str(e)) @@ -3256,7 +3256,7 @@ def test_dbus_p2p_service_discovery(dev, apdev): try: p2p.AddService(args) raise Exception("Invalid AddService() accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e): raise Exception("Unexpected error message for invalid AddService(): " + str(e)) @@ -3266,13 +3266,13 @@ def test_dbus_p2p_service_discovery(dev, apdev): try: p2p.ServiceDiscoveryCancelRequest(ref) raise Exception("Invalid ServiceDiscoveryCancelRequest() accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e): raise Exception("Unexpected error message for invalid AddService(): " + str(e)) try: p2p.ServiceDiscoveryCancelRequest(dbus.UInt64(0)) raise Exception("Invalid ServiceDiscoveryCancelRequest() accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e): raise Exception("Unexpected error message for invalid AddService(): " + str(e)) @@ -3307,7 +3307,7 @@ def test_dbus_p2p_service_discovery(dev, apdev): try: p2p.ServiceDiscoveryRequest(args) raise Exception("Invalid ServiceDiscoveryRequest accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e): raise Exception("Unexpected error message for invalid ServiceDiscoveryRequest(): " + str(e)) @@ -3315,7 +3315,7 @@ def test_dbus_p2p_service_discovery(dev, apdev): try: p2p.ServiceDiscoveryResponse(dbus.Dictionary(args, signature='sv')) raise Exception("Invalid ServiceDiscoveryResponse accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e): raise Exception("Unexpected error message for invalid ServiceDiscoveryResponse(): " + str(e)) @@ -3564,7 +3564,7 @@ def test_dbus_p2p_autogo(dev, apdev): wps.Start(params) self.exceptions = True raise Exception("Invalid WPS.Start() accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e): self.exceptions = True raise Exception("Unexpected error message: " + str(e)) @@ -3641,7 +3641,7 @@ def test_dbus_p2p_autogo(dev, apdev): dbus_interface=dbus.PROPERTIES_IFACE) self.exceptions = True raise Exception("Invalid Set(WPSVendorExtensions) accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "Error.Failed" not in str(e): self.exceptions = True raise Exception("Unexpected error message for invalid Set(WPSVendorExtensions): " + str(e)) @@ -3652,7 +3652,7 @@ def test_dbus_p2p_autogo(dev, apdev): dbus_interface=dbus.PROPERTIES_IFACE) self.exceptions = True raise Exception("Invalid Set(WPSVendorExtensions) accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e): self.exceptions = True raise Exception("Unexpected error message for invalid Set(WPSVendorExtensions): " + str(e)) @@ -3663,7 +3663,7 @@ def test_dbus_p2p_autogo(dev, apdev): dbus_interface=dbus.PROPERTIES_IFACE) self.exceptions = True raise Exception("Invalid Set(WPSVendorExtensions) accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "Error.Failed" not in str(e): self.exceptions = True raise Exception("Unexpected error message for invalid Set(WPSVendorExtensions): " + str(e)) @@ -3674,7 +3674,7 @@ def test_dbus_p2p_autogo(dev, apdev): dbus_interface=dbus.PROPERTIES_IFACE) self.exceptions = True raise Exception("Invalid Set(WPSVendorExtensions) accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "Error.Failed" not in str(e): self.exceptions = True raise Exception("Unexpected error message for invalid Set(WPSVendorExtensions): " + str(e)) @@ -3953,7 +3953,7 @@ def test_dbus_p2p_join(dev, apdev): g_obj.Set(WPAS_DBUS_GROUP, 'WPSVendorExtensions', res, dbus_interface=dbus.PROPERTIES_IFACE) raise Exception("Invalid Set(WPSVendorExtensions) accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "Error.Failed: Failed to set property" not in str(e): raise Exception("Unexpected error message for invalid Set(WPSVendorExtensions): " + str(e)) @@ -4105,7 +4105,7 @@ def _test_dbus_p2p_config(dev, apdev): dbus_interface=dbus.PROPERTIES_IFACE, byte_arrays=True) raise Exception("Invalid Get(P2PDeviceConfig) accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "Error.Failed: P2P is not available for this interface" not in str(e): raise Exception("Unexpected error message for invalid Invite: " + str(e)) finally: @@ -4118,7 +4118,7 @@ def _test_dbus_p2p_config(dev, apdev): dbus.Dictionary(changes, signature='sv'), dbus_interface=dbus.PROPERTIES_IFACE) raise Exception("Invalid Set(P2PDeviceConfig) accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "Error.Failed: P2P is not available for this interface" not in str(e): raise Exception("Unexpected error message for invalid Invite: " + str(e)) finally: @@ -4133,7 +4133,7 @@ def _test_dbus_p2p_config(dev, apdev): dbus.Dictionary(changes, signature='sv'), dbus_interface=dbus.PROPERTIES_IFACE) raise Exception("Invalid Set(P2PDeviceConfig) accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e): raise Exception("Unexpected error message for invalid Invite: " + str(e)) @@ -4226,7 +4226,7 @@ def test_dbus_p2p_persistent(dev, apdev): try: p2p.RemovePersistentGroup(persistent) raise Exception("Invalid RemovePersistentGroup accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "NetworkUnknown: There is no such persistent group" not in str(e): raise Exception("Unexpected error message for invalid RemovePersistentGroup: " + str(e)) @@ -4295,7 +4295,7 @@ def test_dbus_p2p_reinvoke_persistent(dev, apdev): try: pin = p2p.Invite(args) raise Exception("Invalid Invite accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e): raise Exception("Unexpected error message for invalid Invite: " + str(e)) @@ -4412,7 +4412,7 @@ def test_dbus_p2p_go_neg_rx(dev, apdev): try: p2p.Connect(args) raise Exception("Invalid Connect accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "ConnectChannelUnsupported" not in str(e): raise Exception("Unexpected error message for invalid Connect: " + str(e)) @@ -4494,7 +4494,7 @@ def test_dbus_p2p_go_neg_auth(dev, apdev): try: p2p.Connect(args) raise Exception("Invalid Connect accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e): raise Exception("Unexpected error message for invalid Connect: " + str(e)) @@ -5113,7 +5113,7 @@ def test_dbus_p2p_cancel(dev, apdev): try: p2p.Cancel() raise Exception("Unexpected p2p.Cancel() success") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: pass addr0 = dev[0].p2p_dev_addr() @@ -5536,7 +5536,7 @@ def test_dbus_save_config(dev, apdev): try: iface.SaveConfig() raise Exception("SaveConfig() accepted unexpectedly") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if not str(e).startswith("fi.w1.wpa_supplicant1.UnknownError: Not allowed to update configuration"): raise Exception("Unexpected error message for SaveConfig(): " + str(e)) @@ -5557,7 +5557,7 @@ def _test_dbus_vendor_elem(dev, apdev): ie = dbus.ByteArray("\x00\x00") iface.VendorElemAdd(-1, ie) raise Exception("Invalid VendorElemAdd() accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e) or "Invalid ID" not in str(e): raise Exception("Unexpected error message for invalid VendorElemAdd[1]: " + str(e)) @@ -5565,7 +5565,7 @@ def _test_dbus_vendor_elem(dev, apdev): ie = dbus.ByteArray("") iface.VendorElemAdd(1, ie) raise Exception("Invalid VendorElemAdd() accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e) or "Invalid value" not in str(e): raise Exception("Unexpected error message for invalid VendorElemAdd[2]: " + str(e)) @@ -5573,21 +5573,21 @@ def _test_dbus_vendor_elem(dev, apdev): ie = dbus.ByteArray("\x00\x01") iface.VendorElemAdd(1, ie) raise Exception("Invalid VendorElemAdd() accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e) or "Parse error" not in str(e): raise Exception("Unexpected error message for invalid VendorElemAdd[3]: " + str(e)) try: iface.VendorElemGet(-1) raise Exception("Invalid VendorElemGet() accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e) or "Invalid ID" not in str(e): raise Exception("Unexpected error message for invalid VendorElemGet[1]: " + str(e)) try: iface.VendorElemGet(1) raise Exception("Invalid VendorElemGet() accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e) or "ID value does not exist" not in str(e): raise Exception("Unexpected error message for invalid VendorElemGet[2]: " + str(e)) @@ -5595,7 +5595,7 @@ def _test_dbus_vendor_elem(dev, apdev): ie = dbus.ByteArray("\x00\x00") iface.VendorElemRem(-1, ie) raise Exception("Invalid VendorElemRemove() accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e) or "Invalid ID" not in str(e): raise Exception("Unexpected error message for invalid VendorElemRemove[1]: " + str(e)) @@ -5603,7 +5603,7 @@ def _test_dbus_vendor_elem(dev, apdev): ie = dbus.ByteArray("") iface.VendorElemRem(1, ie) raise Exception("Invalid VendorElemRemove() accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e) or "Invalid value" not in str(e): raise Exception("Unexpected error message for invalid VendorElemRemove[1]: " + str(e)) @@ -5634,7 +5634,7 @@ def _test_dbus_vendor_elem(dev, apdev): test_ie = dbus.ByteArray("\x01\x01") iface.VendorElemRem(1, test_ie) raise Exception("Invalid VendorElemRemove() accepted") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e) or "Parse error" not in str(e): raise Exception("Unexpected error message for invalid VendorElemRemove[1]: " + str(e)) @@ -5647,7 +5647,7 @@ def _test_dbus_vendor_elem(dev, apdev): try: iface.VendorElemGet(1) raise Exception("Invalid VendorElemGet() accepted after removal") - except dbus.exceptions.DBusException, e: + except dbus.exceptions.DBusException as e: if "InvalidArgs" not in str(e) or "ID value does not exist" not in str(e): raise Exception("Unexpected error message for invalid VendorElemGet after removal: " + str(e)) |