From cce1dbf3b141b7ede1b3a734ed4b2593005b7b1e Mon Sep 17 00:00:00 2001 From: David Wilson Date: Sun, 20 Jan 2019 07:08:11 +0000 Subject: [PATCH] tests: quieten a bunch of spam printed during run --- mitogen/master.py | 4 ++-- mitogen/service.py | 2 +- tests/data/six_brokenpkg/__init__.py | 4 ++-- tests/service_test.py | 18 ++++++++++++++---- tests/two_three_compat_test.py | 1 + tests/unix_test.py | 14 +++++++++++--- 6 files changed, 31 insertions(+), 12 deletions(-) diff --git a/mitogen/master.py b/mitogen/master.py index 04399ab1..7a9f1dd9 100644 --- a/mitogen/master.py +++ b/mitogen/master.py @@ -714,8 +714,8 @@ class ModuleResponder(object): if tup[2] and is_stdlib_path(tup[2]): # Prevent loading of 2.x<->3.x stdlib modules! This costs one # RTT per hit, so a client-side solution is also required. - LOG.warning('%r: refusing to serve stdlib module %r', - self, fullname) + LOG.debug('%r: refusing to serve stdlib module %r', + self, fullname) self._send_module_load_failed(stream, fullname) return diff --git a/mitogen/service.py b/mitogen/service.py index 5f6f4048..d1285386 100644 --- a/mitogen/service.py +++ b/mitogen/service.py @@ -542,7 +542,7 @@ class Pool(object): msg = self._select.get() except (mitogen.core.ChannelError, mitogen.core.LatchError): e = sys.exc_info()[1] - LOG.info('%r: channel or latch closed, exitting: %s', self, e) + LOG.debug('%r: channel or latch closed, exitting: %s', self, e) return func = self._func_by_recv[msg.receiver] diff --git a/tests/data/six_brokenpkg/__init__.py b/tests/data/six_brokenpkg/__init__.py index 42e633c7..e5944b83 100644 --- a/tests/data/six_brokenpkg/__init__.py +++ b/tests/data/six_brokenpkg/__init__.py @@ -29,9 +29,9 @@ import os.path try: import six as _system_six - print('six_brokenpkg: using system six:', _system_six) + #print('six_brokenpkg: using system six:', _system_six) except ImportError: - print('six_brokenpkg: no system six available') + #print('six_brokenpkg: no system six available') _system_six = None if _system_six: diff --git a/tests/service_test.py b/tests/service_test.py index 0ff16032..e57548da 100644 --- a/tests/service_test.py +++ b/tests/service_test.py @@ -54,8 +54,13 @@ class ActivationTest(testlib.RouterMixin, testlib.TestCase): l1 = self.router.fork() l2 = self.router.fork() l1.call_service(MyService, 'get_id') # force framework activation - exc = self.assertRaises(mitogen.core.CallError, - lambda: l2.call(call_service_in, l1, MyService2.name(), 'get_id')) + capture = testlib.LogCapturer() + capture.start() + try: + exc = self.assertRaises(mitogen.core.CallError, + lambda: l2.call(call_service_in, l1, MyService2.name(), 'get_id')) + finally: + capture.stop() msg = mitogen.service.Activator.not_active_msg % (MyService2.name(),) self.assertTrue(msg in exc.args[0]) @@ -80,8 +85,13 @@ class PermissionTest(testlib.RouterMixin, testlib.TestCase): l1 = self.router.fork() l1.call_service(MyService, 'get_id') l2 = self.router.fork() - exc = self.assertRaises(mitogen.core.CallError, lambda: - l2.call(call_service_in, l1, MyService.name(), 'privileged_op')) + capture = testlib.LogCapturer() + capture.start() + try: + exc = self.assertRaises(mitogen.core.CallError, lambda: + l2.call(call_service_in, l1, MyService.name(), 'privileged_op')) + finally: + capture.stop() msg = mitogen.service.Invoker.unauthorized_msg % ( u'privileged_op', MyService.name(), diff --git a/tests/two_three_compat_test.py b/tests/two_three_compat_test.py index babbbe39..f6f092d0 100644 --- a/tests/two_three_compat_test.py +++ b/tests/two_three_compat_test.py @@ -13,6 +13,7 @@ import testlib def roundtrip(*args): return args + class TwoThreeCompatTest(testlib.RouterMixin, testlib.TestCase): if mitogen.core.PY3: python_path = 'python2' diff --git a/tests/unix_test.py b/tests/unix_test.py index ee9499ba..300efb84 100644 --- a/tests/unix_test.py +++ b/tests/unix_test.py @@ -62,9 +62,17 @@ class ListenerTest(testlib.RouterMixin, testlib.TestCase): def test_constructor_basic(self): listener = self.klass(router=self.router) - self.assertFalse(mitogen.unix.is_path_dead(listener.path)) - os.unlink(listener.path) - + capture = testlib.LogCapturer() + capture.start() + try: + self.assertFalse(mitogen.unix.is_path_dead(listener.path)) + os.unlink(listener.path) + # ensure we catch 0 byte read error log message + self.broker.shutdown() + self.broker.join() + self.broker_shutdown = True + finally: + capture.stop() class ClientTest(testlib.TestCase): klass = mitogen.unix.Listener