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' sockname = '/var/run/log'
else: else:
sockname = '/dev/log' sockname = '/dev/log'
try:
h = logging.handlers.SysLogHandler(sockname) h = logging.handlers.SysLogHandler(sockname)
self.assertEqual(h.facility, h.LOG_USER) self.assertEqual(h.facility, h.LOG_USER)
self.assertTrue(h.unixsocket) self.assertTrue(h.unixsocket)
h.close() h.close()
except socket.error: # syslogd might not be available
pass
h = logging.handlers.SMTPHandler('localhost', 'me', 'you', 'Log') h = logging.handlers.SMTPHandler('localhost', 'me', 'you', 'Log')
self.assertEqual(h.toaddrs, ['you']) self.assertEqual(h.toaddrs, ['you'])
h.close() h.close()