Refs #32074 -- Removed usage of deprecated Thread.setDaemon().

Thread.setDaemon() was deprecated in Python 3.10 and will be removed in
Python 3.12.
This commit is contained in:
Karthikeyan Singaravelan 2021-04-13 06:05:12 +00:00 committed by Mariusz Felisiak
parent 623c8cd8f4
commit f9f6bd63c9
2 changed files with 2 additions and 2 deletions

View File

@ -610,7 +610,7 @@ def start_django(reloader, main_func, *args, **kwargs):
main_func = check_errors(main_func)
django_main_thread = threading.Thread(target=main_func, args=args, kwargs=kwargs, name='django-main-thread')
django_main_thread.setDaemon(True)
django_main_thread.daemon = True
django_main_thread.start()
while not reloader.should_stop:

View File

@ -364,7 +364,7 @@ class StartDjangoTests(SimpleTestCase):
mocked_thread.call_args[1],
{'target': fake_main_func, 'args': (123,), 'kwargs': {'abc': 123}, 'name': 'django-main-thread'}
)
self.assertSequenceEqual(fake_thread.setDaemon.call_args[0], [True])
self.assertIs(fake_thread.daemon, True)
self.assertTrue(fake_thread.start.called)