From 612357f8ef729689cf52101add8c90d0528a7421 Mon Sep 17 00:00:00 2001
From: Julien Phalip <jphalip@gmail.com>
Date: Sun, 25 Nov 2012 12:55:23 +0100
Subject: [PATCH] Fixed #19355 -- Improved LiveServerThread's handling of
 exceptions. Thanks to flub for the report.

---
 django/test/testcases.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/django/test/testcases.py b/django/test/testcases.py
index 3bb40a5838..6b4885f93f 100644
--- a/django/test/testcases.py
+++ b/django/test/testcases.py
@@ -1022,6 +1022,7 @@ class LiveServerThread(threading.Thread):
                         (self.host, port), QuietWSGIRequestHandler)
                 except WSGIServerException as e:
                     if (index + 1 < len(self.possible_ports) and
+                        hasattr(e.args[0], 'errno') and
                         e.args[0].errno == errno.EADDRINUSE):
                         # This port is already in use, so we go on and try with
                         # the next one in the list.