From: Jonathan Afek Date: Thu, 23 Jun 2016 17:16:32 +0000 (+0300) Subject: tests: Initialize hapd variable before try-finally uses X-Git-Tag: hostap_2_6~311 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f8b9e61ef0c4dd5d53fbdad315c87f2f7b54e411;p=thirdparty%2Fhostap.git tests: Initialize hapd variable before try-finally uses Some TDLS and WPS test cases reference the hapd variable in the finally block even if the test failed before assigning the value to this variable. This makes the code in the finally block to fail on referencing this variable. Assign None to the hapd variable before starting the tests to avoid this. Signed-off-by: Jonathan Afek --- diff --git a/tests/hwsim/test_ap_tdls.py b/tests/hwsim/test_ap_tdls.py index 138f21cbc..44c7b48d5 100644 --- a/tests/hwsim/test_ap_tdls.py +++ b/tests/hwsim/test_ap_tdls.py @@ -361,6 +361,7 @@ def test_ap_open_tdls_vht(dev, apdev): "vht_capab": "", "vht_oper_chwidth": "0", "vht_oper_centr_freq_seg0_idx": "0" } + hapd = None try: hapd = hostapd.add_ap(apdev[0], params) wlantest_setup(hapd) diff --git a/tests/hwsim/test_nfc_wps.py b/tests/hwsim/test_nfc_wps.py index 6cb3ecb42..b65c7877f 100644 --- a/tests/hwsim/test_nfc_wps.py +++ b/tests/hwsim/test_nfc_wps.py @@ -233,6 +233,7 @@ def test_nfc_wps_handover(dev, apdev): def test_nfc_wps_handover_5ghz(dev, apdev): """Connect to WPS AP with NFC connection handover on 5 GHz band""" + hapd = None try: ssid = "test-wps-nfc-handover" params = ap_wps_params(ssid) @@ -265,6 +266,7 @@ def test_nfc_wps_handover_5ghz(dev, apdev): def test_nfc_wps_handover_chan14(dev, apdev): """Connect to WPS AP with NFC connection handover on channel 14""" + hapd = None try: ssid = "test-wps-nfc-handover" params = ap_wps_params(ssid)