diff options
| -rw-r--r-- | django/test/testcases.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/django/test/testcases.py b/django/test/testcases.py index de2a3eb61d..b31e70d9d1 100644 --- a/django/test/testcases.py +++ b/django/test/testcases.py @@ -1783,11 +1783,12 @@ class LiveServerThread(threading.Thread): ) def terminate(self): - if hasattr(self, "httpd"): - # Stop the WSGI server - self.httpd.shutdown() - self.httpd.server_close() - self.join() + if self.is_ready.is_set(): + if hasattr(self, "httpd"): + # Stop the WSGI server + self.httpd.shutdown() + self.httpd.server_close() + self.join() class LiveServerTestCase(TransactionTestCase): |
