summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorMarten Kenbeek <marten.knbk@gmail.com>2015-12-30 13:23:50 +0100
committerTim Graham <timograham@gmail.com>2015-12-31 10:57:03 -0500
commitc87540cee5a3d5b676b9359c01bdea35f733aabb (patch)
treeb75fdd881a4d855c1e0138b372636d4af988c0a2 /django
parent89616f0c790376867ba31ada27554f40bfeb228e (diff)
Fixed #26011 -- Prevented random LiveServerTestCase test failures on Windows.
Prevented LiveServerTestCase from stealing ports used by concurrent processes on Windows.
Diffstat (limited to 'django')
-rw-r--r--django/core/servers/basehttp.py1
-rw-r--r--django/test/testcases.py2
2 files changed, 2 insertions, 1 deletions
diff --git a/django/core/servers/basehttp.py b/django/core/servers/basehttp.py
index 4e2f8dd863..b9184ca20d 100644
--- a/django/core/servers/basehttp.py
+++ b/django/core/servers/basehttp.py
@@ -70,6 +70,7 @@ class WSGIServer(simple_server.WSGIServer, object):
def __init__(self, *args, **kwargs):
if kwargs.pop('ipv6', False):
self.address_family = socket.AF_INET6
+ self.allow_reuse_address = kwargs.pop('allow_reuse_address', True)
super(WSGIServer, self).__init__(*args, **kwargs)
def server_bind(self):
diff --git a/django/test/testcases.py b/django/test/testcases.py
index 2acacd5a91..4e4ada9c64 100644
--- a/django/test/testcases.py
+++ b/django/test/testcases.py
@@ -1252,7 +1252,7 @@ class LiveServerThread(threading.Thread):
self.is_ready.set()
def _create_server(self, port):
- return WSGIServer((self.host, port), QuietWSGIRequestHandler)
+ return WSGIServer((self.host, port), QuietWSGIRequestHandler, allow_reuse_address=False)
def terminate(self):
if hasattr(self, 'httpd'):