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 <takanattie@gmail.com>
This commit is contained in:
Takashi Natsume 2022-09-25 15:46:49 +09:00
parent fd6dab160d
commit 5f429b7230
2 changed files with 2 additions and 2 deletions

View File

@ -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):

View File

@ -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):