diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2011-04-27 13:18:06 (GMT) |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2011-04-27 13:18:06 (GMT) |
commit | dbeb27461c2de891ae6cfe42c803e4ca7a111c15 (patch) | |
tree | 3e0c2b88b212a6be86248666df3f5e89efc0e170 | |
parent | 5a35b06d5e5b6d12abcc1529cbb643fdcf0d35ab (diff) | |
download | cpython-dbeb27461c2de891ae6cfe42c803e4ca7a111c15.zip cpython-dbeb27461c2de891ae6cfe42c803e4ca7a111c15.tar.gz cpython-dbeb27461c2de891ae6cfe42c803e4ca7a111c15.tar.bz2 |
test_logging: handle syslogd connection failure.
-rw-r--r-- | Lib/test/test_logging.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index 567d084..234d5ff 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() |