From: Vinay Sajip Date: Wed, 27 Apr 2011 13:18:06 +0000 (+0100) Subject: test_logging: handle syslogd connection failure. X-Git-Tag: v3.3.0a1~2490 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dbeb27461c2de891ae6cfe42c803e4ca7a111c15;p=python test_logging: handle syslogd connection failure. --- diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index 567d084f0b..234d5ff142 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -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()