From cb32175bfde5733cffc45be34448b236411a589f Mon Sep 17 00:00:00 2001 From: Unai Zalakain Date: Wed, 2 Oct 2013 15:27:38 +0200 Subject: [PATCH] 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. --- django/test/testcases.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/django/test/testcases.py b/django/test/testcases.py index fa044ba6ec..457c12f559 100644 --- a/django/test/testcases.py +++ b/django/test/testcases.py @@ -1063,12 +1063,14 @@ class LiveServerThread(threading.Thread): self.error = e self.is_ready.set() - def join(self, timeout=None): + def terminate(self): + """ + Shuts down live WSGI server. + """ if hasattr(self, 'httpd'): # Stop the WSGI server self.httpd.shutdown() self.httpd.server_close() - super(LiveServerThread, self).join(timeout) class LiveServerTestCase(TransactionTestCase): @@ -1148,6 +1150,7 @@ class LiveServerTestCase(TransactionTestCase): # reasons has raised an exception. if hasattr(cls, 'server_thread'): # Terminate the live server's thread + cls.server_thread.terminate() cls.server_thread.join() # Restore sqlite connections' non-sharability