From dbeb27461c2de891ae6cfe42c803e4ca7a111c15 Mon Sep 17 00:00:00 2001 From: Vinay Sajip Date: Wed, 27 Apr 2011 14:18:06 +0100 Subject: [PATCH] test_logging: handle syslogd connection failure. --- Lib/test/test_logging.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index 567d084f0b7..234d5ff142c 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()