mirror of
https://github.com/django/django.git
synced 2025-10-05 08:10:36 +00:00
[1.6.x] Fixed "Address already in use" from liveserver.
Our WSGIServer rewrapped the socket errors from server_bind into
WSGIServerExceptions, which is used later on to provide nicer
error messages in runserver and used by the liveserver to see if
the port is already in use. But wrapping server_bind isn't enough since
it only binds to the socket, socket.listen (which is called from
server_activate) could also raise "Address already in use".
Instead of overriding server_activate too I chose to just catch socket
errors, which seems to make more sense anyways and should be more robust
against changes in wsgiref.
Backport of 2ca00faa91
from master.
This commit is contained in:
parent
b2876c0c91
commit
56201fe5a8
4 changed files with 15 additions and 22 deletions
|
@ -5,10 +5,10 @@ Tests for django.core.servers.
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import os
|
||||
import socket
|
||||
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.test import LiveServerTestCase
|
||||
from django.core.servers.basehttp import WSGIServerException
|
||||
from django.test.utils import override_settings
|
||||
from django.utils.http import urlencode
|
||||
from django.utils.six.moves.urllib.error import HTTPError
|
||||
|
@ -71,7 +71,7 @@ class LiveServerAddress(LiveServerBase):
|
|||
cls.raises_exception('localhost', ImproperlyConfigured)
|
||||
|
||||
# The host must be valid
|
||||
cls.raises_exception('blahblahblah:8081', WSGIServerException)
|
||||
cls.raises_exception('blahblahblah:8081', socket.error)
|
||||
|
||||
# The list of ports must be in a valid format
|
||||
cls.raises_exception('localhost:8081,', ImproperlyConfigured)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue