summaryrefslogtreecommitdiff
path: root/tests/servers
diff options
context:
space:
mode:
authorFlorian Apolloner <florian@apolloner.eu>2013-09-22 15:55:09 +0200
committerFlorian Apolloner <florian@apolloner.eu>2013-09-22 22:02:59 +0200
commit2ca00faa913754cd5860f6e1f23c8da2529c691a (patch)
treea25df91ed793be418f0fe71191050972717c9313 /tests/servers
parentbebb449ac334d7365a015b34b9c894dc4bf63f7f (diff)
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.
Diffstat (limited to 'tests/servers')
-rw-r--r--tests/servers/tests.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/servers/tests.py b/tests/servers/tests.py
index f833570862..77c2e39521 100644
--- a/tests/servers/tests.py
+++ b/tests/servers/tests.py
@@ -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)