﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
19355	LiveServerThread handles caught exceptions incorrectly	flub@…	nobody	"In django.test.testcases.LiveServerThread.run a WSGIServerException is caught and the code expects it to have an errno attribute.  However not WSGIServerException is a subclass of Exception and thus not guaranteed to have the errno attribute.  The following short patch avoids this problem:

diff --git a/django/test/testcases.py b/django/test/testcases.py
index 3bb40a5..ef4c8118 100644
--- a/django/test/testcases.py
+++ b/django/test/testcases.py
@@ -1022,7 +1022,7 @@ class LiveServerThread(threading.Thread):
                         (self.host, port), QuietWSGIRequestHandler)
                 except WSGIServerException as e:
                     if (index + 1 < len(self.possible_ports) and
-                        e.args[0].errno == errno.EADDRINUSE):
+                        getattr(e.args[0], 'errno', 0) == errno.EADDRINUSE):
                         # This port is already in use, so we go on and try with
                         # the next one in the list.
                         continue
"	Bug	new	Testing framework	dev	Normal				Unreviewed	1	0	0	0	1	0
