summaryrefslogtreecommitdiff
path: root/django/test
diff options
context:
space:
mode:
authorChris Jerdonek <chris.jerdonek@gmail.com>2016-08-19 09:47:41 -0700
committerTim Graham <timograham@gmail.com>2016-08-19 12:47:41 -0400
commitf6cd669ff203192c29495174e53da6b16883b039 (patch)
tree60a16de6590c6ee18e67470b49afab16b071d0f2 /django/test
parent7b08e01c1358aedbd46fa26c91d4613d642ff609 (diff)
Fixed #22414 -- Ensured that LiveServerTestCase closes connections.
Diffstat (limited to 'django/test')
-rw-r--r--django/test/testcases.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/django/test/testcases.py b/django/test/testcases.py
index 399c8adf57..8fd84b1423 100644
--- a/django/test/testcases.py
+++ b/django/test/testcases.py
@@ -1262,6 +1262,8 @@ class LiveServerThread(threading.Thread):
except Exception as e:
self.error = e
self.is_ready.set()
+ finally:
+ connections.close_all()
def _create_server(self, port):
return WSGIServer((self.host, port), QuietWSGIRequestHandler, allow_reuse_address=False)
@@ -1271,6 +1273,7 @@ class LiveServerThread(threading.Thread):
# Stop the WSGI server
self.httpd.shutdown()
self.httpd.server_close()
+ self.join()
class LiveServerTestCase(TransactionTestCase):
@@ -1335,7 +1338,6 @@ class LiveServerTestCase(TransactionTestCase):
if hasattr(cls, 'server_thread'):
# Terminate the live server's thread
cls.server_thread.terminate()
- cls.server_thread.join()
# Restore sqlite in-memory database connections' non-shareability
for conn in connections.all():