test_logging: handle syslogd connection failure.
This commit is contained in:
parent
5a35b06d5e
commit
dbeb27461c
|
@ -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()
|
||||||
|
|
Loading…
Reference in New Issue