[PATCH] tests: Replace deprecated thread isAlive function
Andrei Otcheretianski
andrei.otcheretianski at intel.com
Tue Feb 16 08:45:07 EST 2021
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 at intel.com>
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
---
tests/hwsim/remotehost.py | 10 +++++-----
tests/remote/rutils.py | 8 ++++----
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/tests/hwsim/remotehost.py b/tests/hwsim/remotehost.py
index 9df3d80752..0799b951f2 100644
--- a/tests/hwsim/remotehost.py
+++ b/tests/hwsim/remotehost.py
@@ -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):
diff --git a/tests/remote/rutils.py b/tests/remote/rutils.py
index 0585480a2b..6902991124 100644
--- a/tests/remote/rutils.py
+++ b/tests/remote/rutils.py
@@ -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
--
2.28.0
More information about the Hostap
mailing list