mirror of https://github.com/django/django.git
Fixed ticket #21172
LiveServerThread.join() now behaves like threading.Thread.join(). LiveServerThread.terminate() is instead used to ask live http server to terminate and close.
This commit is contained in:
parent
9b95fa7777
commit
cb32175bfd
|
@ -1063,12 +1063,14 @@ class LiveServerThread(threading.Thread):
|
||||||
self.error = e
|
self.error = e
|
||||||
self.is_ready.set()
|
self.is_ready.set()
|
||||||
|
|
||||||
def join(self, timeout=None):
|
def terminate(self):
|
||||||
|
"""
|
||||||
|
Shuts down live WSGI server.
|
||||||
|
"""
|
||||||
if hasattr(self, 'httpd'):
|
if hasattr(self, 'httpd'):
|
||||||
# Stop the WSGI server
|
# Stop the WSGI server
|
||||||
self.httpd.shutdown()
|
self.httpd.shutdown()
|
||||||
self.httpd.server_close()
|
self.httpd.server_close()
|
||||||
super(LiveServerThread, self).join(timeout)
|
|
||||||
|
|
||||||
|
|
||||||
class LiveServerTestCase(TransactionTestCase):
|
class LiveServerTestCase(TransactionTestCase):
|
||||||
|
@ -1148,6 +1150,7 @@ class LiveServerTestCase(TransactionTestCase):
|
||||||
# reasons has raised an exception.
|
# reasons has raised an exception.
|
||||||
if hasattr(cls, 'server_thread'):
|
if hasattr(cls, 'server_thread'):
|
||||||
# Terminate the live server's thread
|
# Terminate the live server's thread
|
||||||
|
cls.server_thread.terminate()
|
||||||
cls.server_thread.join()
|
cls.server_thread.join()
|
||||||
|
|
||||||
# Restore sqlite connections' non-sharability
|
# Restore sqlite connections' non-sharability
|
||||||
|
|
Loading…
Reference in New Issue