mirror of
https://github.com/python/cpython.git
synced 2025-10-14 18:59:46 +00:00
test_logging: handle syslogd connection failure.
This commit is contained in:
parent
5a35b06d5e
commit
dbeb27461c
1 changed files with 7 additions and 4 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue