test_logging: handle syslogd connection failure.

This commit is contained in:
Vinay Sajip 2011-04-27 14:18:06 +01:00
parent 5a35b06d5e
commit dbeb27461c
1 changed files with 7 additions and 4 deletions

View File

@ -531,10 +531,13 @@ class HandlerTest(BaseTest):
sockname = '/var/run/log'
else:
sockname = '/dev/log'
h = logging.handlers.SysLogHandler(sockname)
self.assertEqual(h.facility, h.LOG_USER)
self.assertTrue(h.unixsocket)
h.close()
try:
h = logging.handlers.SysLogHandler(sockname)
self.assertEqual(h.facility, h.LOG_USER)
self.assertTrue(h.unixsocket)
h.close()
except socket.error: # syslogd might not be available
pass
h = logging.handlers.SMTPHandler('localhost', 'me', 'you', 'Log')
self.assertEqual(h.toaddrs, ['you'])
h.close()