[Python-checkins] cpython: test_logging: handle syslogd connection failure.
vinay.sajip
python-checkins at python.org
Wed Apr 27 15:18:36 CEST 2011
http://hg.python.org/cpython/rev/ec0120219925
changeset: 69594:ec0120219925
user: Vinay Sajip <vinay_sajip at yahoo.co.uk>
date: Wed Apr 27 14:18:06 2011 +0100
summary:
test_logging: handle syslogd connection failure.
files:
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
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -531,10 +531,13 @@
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()
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list