From 854db518452d10190f90d899b640b402443544eb Mon Sep 17 00:00:00 2001 From: Samuel Merritt Date: Thu, 24 May 2018 14:14:34 -0700 Subject: [PATCH] Fix common/test_utils.py on Python 3.5.4+ In CPython commit e59af55c2, instantiating a logging.SysLogHandler stopped raising an exception if the syslog server was unavailable. This commit first appears in CPython 3.5.4. utils.get_logger() catches that error and retries the instantiation, and there a test asserting that. The test fails on Python 3.5.4 or greater, so now it has been corrected to only assert things about the first instantiation of logging.SysLogHandler and passes on Python 3.5.4 and 3.5.5. This was noticed by running "tox -e py35" on an Ubuntu 18.04 system, which ships with Python 3.5.5. Change-Id: I43f231bd7d3566b9849a48f46ec9e2af4cd23be4 --- test/unit/common/test_utils.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/test/unit/common/test_utils.py b/test/unit/common/test_utils.py index 07b5fb5d4f..d8f1dd62f5 100644 --- a/test/unit/common/test_utils.py +++ b/test/unit/common/test_utils.py @@ -1626,13 +1626,10 @@ class TestUtils(unittest.TestCase): 'log_facility': 'LOG_LOCAL3', 'log_address': '/foo/bar', }, 'server', log_route='server') - self.assertEqual([ + self.assertEqual( ((), {'address': '/foo/bar', 'facility': orig_sysloghandler.LOG_LOCAL3}), - # Second call is because /foo/bar didn't exist (and wasn't a - # UNIX domain socket). - ((), {'facility': orig_sysloghandler.LOG_LOCAL3})], - syslog_handler_args) + syslog_handler_args[0]) # Using UDP with default port syslog_handler_args = []