]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Replace deprecated thread isAlive function
authorAndrei Otcheretianski <andrei.otcheretianski@intel.com>
Tue, 16 Feb 2021 13:45:07 +0000 (15:45 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 19 Feb 2021 22:16:33 +0000 (00:16 +0200)
The isAlive() function is deprecated in newer versions of Python
so replace it with the is_alive() instead.

Signed-off-by: Oren Givon <oren.givon@intel.com>
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
tests/hwsim/remotehost.py
tests/remote/rutils.py

index 9df3d807525917bf5266e8cc8acc6f99024300eb..0799b951f2e75c0d495eb65c4dcaafc173c5c70b 100644 (file)
@@ -127,24 +127,24 @@ class Host():
 
         pid_file = t.name + ".pid"
 
-        if t.isAlive():
+        if t.is_alive():
             cmd = ["kill `cat " + pid_file + "`"]
             self.execute(cmd)
 
         # try again
         self.thread_wait(t, 5)
-        if t.isAlive():
+        if t.is_alive():
             cmd = ["kill `cat " + pid_file + "`"]
             self.execute(cmd)
 
         # try with -9
         self.thread_wait(t, 5)
-        if t.isAlive():
+        if t.is_alive():
             cmd = ["kill -9 `cat " + pid_file + "`"]
             self.execute(cmd)
 
         self.thread_wait(t, 5)
-        if t.isAlive():
+        if t.is_alive():
             raise Exception("thread still alive")
 
         self.execute(["rm", pid_file])
@@ -158,7 +158,7 @@ class Host():
             wait_str = str(wait) + "s"
 
         logger.debug(self.name + " thread_wait(" + wait_str + "): ")
-        if t.isAlive():
+        if t.is_alive():
             t.join(wait)
 
     def pending(self, s, timeout=0):
index 0585480a2b7d11f1a3237ad613c4ed7dc91e7d34..6902991124c8ba0671af544bcc68eeec38a6bbe5 100644 (file)
@@ -347,7 +347,7 @@ def ping_run(host, ip, result, ifname=None, addr_type="ipv4", deadline="5", qos=
 
 def ping_wait(host, thread, timeout=None):
     host.thread_wait(thread, timeout)
-    if thread.isAlive():
+    if thread.is_alive():
         raise Exception("ping thread still alive")
 
 def flush_arp_cache(host):
@@ -504,16 +504,16 @@ def iperf_run(server, client, server_ip, client_res, server_res,
 
 def iperf_wait(server, client, server_thread, client_thread, timeout=None, iperf="iperf"):
     client.thread_wait(client_thread, timeout)
-    if client_thread.isAlive():
+    if client_thread.is_alive():
         raise Exception("iperf client thread still alive")
 
     server.thread_wait(server_thread, 5)
-    if server_thread.isAlive():
+    if server_thread.is_alive():
         server.execute(["killall", "-s", "INT", iperf])
         time.sleep(1)
 
     server.thread_wait(server_thread, 5)
-    if server_thread.isAlive():
+    if server_thread.is_alive():
         raise Exception("iperf server thread still alive")
 
     return