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: I643251c0394b8e8ede8198f580549ef6f260a9de
Signed-off-by: Takashi Natsume <takanattie@gmail.com>
This commit is contained in:
Takashi Natsume 2022-08-24 23:26:02 +09:00
parent b42b5e5b54
commit afcf34decc
3 changed files with 3 additions and 3 deletions

View File

@ -48,7 +48,7 @@ class InstancemonitorManager(manager.Manager):
self.event_loop_thread = threading.Thread(
target=self._vir_event_loop_native_run,
name="lib_virt_eventLoop")
self.event_loop_thread.setDaemon(True)
self.event_loop_thread.daemon = True
self.event_loop_thread.start()
def _my_domain_event_callback(self, conn, dom, event, detail, opaque):

View File

@ -107,7 +107,7 @@ class IntrospectiveInstanceMonitorManager(manager.Manager):
self.event_loop_thread = threading.Thread(
target=self._vir_event_loop_native_run,
name="lib_virt_eventLoop")
self.event_loop_thread.setDaemon(True)
self.event_loop_thread.daemon = True
self.event_loop_thread.start()
def _my_domain_event_callback(self, conn, dom, event, detail, opaque):

View File

@ -240,7 +240,7 @@ class TestInstancemonitorManager(testtools.TestCase):
handlers_count = 9
self.assertTrue(exception_flag)
mock_virEventRegisterDefaultImpl.assert_called_once()
mock_event_loop_thread.setDaemon.assert_called_once_with(True)
self.assertEqual(True, mock_event_loop_thread.daemon)
mock_event_loop_thread.start.assert_called_once()
mock_openAuth.assert_called_once_with(
"qemu:///system",