diff --git a/django/test/testcases.py b/django/test/testcases.py
index 30d6e98..5625b91 100644
a
|
b
|
class StoppableWSGIServer(WSGIServer):
|
778 | 778 | r, w, e = select.select([self], [], [], poll_interval) |
779 | 779 | if r: |
780 | 780 | self._handle_request_noblock() |
| 781 | self.__serving = None |
781 | 782 | self.__is_shut_down.set() |
782 | 783 | |
783 | 784 | def shutdown(self): |
… |
… |
class StoppableWSGIServer(WSGIServer):
|
788 | 789 | deadlock. |
789 | 790 | """ |
790 | 791 | self.__serving = False |
791 | | self.__is_shut_down.wait() |
| 792 | self.__is_shut_down.wait(2) |
| 793 | if self.__serving is not None: |
| 794 | raise RuntimeError("Failed to shutdown the server in 2 seconds. " |
| 795 | "The server might be stuck, or generating a slow response.") |
792 | 796 | |
793 | 797 | def handle_request(self): |
794 | 798 | """Handle one request, possibly blocking. |
… |
… |
class LiveServerThread(threading.Thread):
|
865 | 869 | except WSGIServerException, e: |
866 | 870 | self.error = e |
867 | 871 | self.is_ready.set() |
| 872 | except Exception, e: |
| 873 | self.error = e |
| 874 | self.is_ready.set() |
868 | 875 | |
869 | 876 | def join(self, timeout=None): |
870 | 877 | self.httpd.shutdown() |
… |
… |
class LiveServerTestCase(TransactionTestCase):
|
904 | 911 | settings.LIVE_TEST_SERVER_HOST, |
905 | 912 | int(settings.LIVE_TEST_SERVER_PORT), |
906 | 913 | connections_override) |
| 914 | cls.server_thread.daemon = True |
907 | 915 | cls.server_thread.start() |
908 | 916 | |
909 | 917 | # Wait for the Django server to be ready |