Don't error out because of bad file descriptor errors

This commit is contained in:
Pedro Algarvio 2017-04-18 13:55:50 +01:00
parent 102d63e238
commit 5ed3d8d98c
No known key found for this signature in database
GPG Key ID: BB36BF6584A298FF

View File

@ -6,6 +6,8 @@
# Import python libs
from __future__ import absolute_import
import os
import errno
import socket
import logging
import tornado.gen
@ -49,7 +51,12 @@ class BaseIPCReqCase(tornado.testing.AsyncTestCase):
def tearDown(self):
super(BaseIPCReqCase, self).tearDown()
#failures = []
self.server_channel.close()
try:
self.server_channel.close()
except socket.error as exc:
if exc.errno != errno.EBADF:
# If its not a bad file descriptor error, raise
raise
os.unlink(self.socket_path)
#for k, v in six.iteritems(self.io_loop._handlers):
# if self._start_handlers.get(k) != v:
@ -89,7 +96,12 @@ class IPCMessageClient(BaseIPCReqCase):
def tearDown(self):
super(IPCMessageClient, self).tearDown()
self.channel.close()
try:
self.channel.close()
except socket.error as exc:
if exc.errno != errno.EBADF:
# If its not a bad file descriptor error, raise
raise
def test_basic_send(self):
msg = {'foo': 'bar', 'stop': True}