#21227: Selenium tests terminate with [Errno 10054]
-------------------------------------+-------------------------------------
Reporter: Kevin Christopher | Owner: nobody
Henry |
Type: Bug | Status: new
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: selenium | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by mrts):
I got rid of the `ConnectionResetError` by creating
`ConnectionResetErrorSwallowingLiveServerThread` as follows that swallows
the error:
{{{
import socket
import errno
from django.core.servers.basehttp import ThreadedWSGIServer
from django.test.testcases import QuietWSGIRequestHandler,
LiveServerThread
class
ConnectionResetErrorSwallowingQuietWSGIRequestHandler(QuietWSGIRequestHandler):
def handle_one_request(self):
try:
super().handle_one_request()
except socket.error as err:
if err.errno != errno.WSAECONNRESET:
raise
class ConnectionResetErrorSwallowingLiveServerThread(LiveServerThread):
def _create_server(self):
return ThreadedWSGIServer((self.host, self.port),
ConnectionResetErrorSwallowingQuietWSGIRequestHandler,
allow_reuse_address=False)
}}}
It can be used it in tests that extend `StaticLiveServerTestCase` as
follows:
{{{
class AdminSiteTestCase(StaticLiveServerTestCase):
server_thread_class = ConnectionResetErrorSwallowingLiveServerThread
}}}
@timgraham, what do you think, could something like this be added to
`django.test.testcases`?
--
Ticket URL: <https://code.djangoproject.com/ticket/21227#comment:14>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/065.7a2f806907bb0ebed06c0cd5b782824d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.