From 5f429b72303abbad7bbd88dfc621166e3faabf90 Mon Sep 17 00:00:00 2001 From: Takashi Natsume Date: Sun, 25 Sep 2022 15:46:49 +0900 Subject: [PATCH] Use daemon property instead of setDaemon method The setDaemon method of the threading.Thread was deprecated in Python 3.10 (*). Replace the setDaemon method with the daemon property. *: https://docs.python.org/3.10/library/threading.html#threading.Thread.setDaemon Change-Id: Id4b6df45ba4741e410692df7bd11db3f56f00f45 Signed-off-by: Takashi Natsume --- ovsdbapp/backend/ovs_idl/connection.py | 2 +- ovsdbapp/tests/unit/backend/ovs_idl/test_connection.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ovsdbapp/backend/ovs_idl/connection.py b/ovsdbapp/backend/ovs_idl/connection.py index cfad90f4..c55ce227 100644 --- a/ovsdbapp/backend/ovs_idl/connection.py +++ b/ovsdbapp/backend/ovs_idl/connection.py @@ -89,7 +89,7 @@ class Connection(object): self.poller = poller.Poller() self.is_running = True self.thread = threading.Thread(target=self.run) - self.thread.setDaemon(True) + self.thread.daemon = True self.thread.start() def run(self): diff --git a/ovsdbapp/tests/unit/backend/ovs_idl/test_connection.py b/ovsdbapp/tests/unit/backend/ovs_idl/test_connection.py index a6291426..f0c445a3 100644 --- a/ovsdbapp/tests/unit/backend/ovs_idl/test_connection.py +++ b/ovsdbapp/tests/unit/backend/ovs_idl/test_connection.py @@ -41,7 +41,7 @@ class TestOVSNativeConnection(base.TestCase): mock_wait_for_change.assert_any_call(self.conn.idl, self.conn.timeout) mock_poller.assert_called_once_with() mock_thread.assert_called_once_with(target=self.conn.run) - mock_thread.return_value.setDaemon.assert_called_once_with(True) + self.assertIs(True, mock_thread.return_value.daemon) mock_thread.return_value.start.assert_called_once_with() def test_queue_txn(self, mock_thread):