1
0
mirror of https://github.com/django/django.git synced 2025-10-26 15:16:09 +00:00

Fixed #26011 -- Prevented random LiveServerTestCase test failures on Windows.

Prevented LiveServerTestCase from stealing ports used by concurrent
processes on Windows.
This commit is contained in:
Marten Kenbeek
2015-12-30 13:23:50 +01:00
committed by Tim Graham
parent 89616f0c79
commit c87540cee5
3 changed files with 31 additions and 1 deletions

View File

@@ -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):

View File

@@ -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'):