tests: quieten a bunch of spam printed during run

issue510
David Wilson 6 years ago
parent b0e7c1a315
commit cce1dbf3b1

@ -714,7 +714,7 @@ class ModuleResponder(object):
if tup[2] and is_stdlib_path(tup[2]): if tup[2] and is_stdlib_path(tup[2]):
# Prevent loading of 2.x<->3.x stdlib modules! This costs one # Prevent loading of 2.x<->3.x stdlib modules! This costs one
# RTT per hit, so a client-side solution is also required. # RTT per hit, so a client-side solution is also required.
LOG.warning('%r: refusing to serve stdlib module %r', LOG.debug('%r: refusing to serve stdlib module %r',
self, fullname) self, fullname)
self._send_module_load_failed(stream, fullname) self._send_module_load_failed(stream, fullname)
return return

@ -542,7 +542,7 @@ class Pool(object):
msg = self._select.get() msg = self._select.get()
except (mitogen.core.ChannelError, mitogen.core.LatchError): except (mitogen.core.ChannelError, mitogen.core.LatchError):
e = sys.exc_info()[1] 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 return
func = self._func_by_recv[msg.receiver] func = self._func_by_recv[msg.receiver]

@ -29,9 +29,9 @@ import os.path
try: try:
import six as _system_six import six as _system_six
print('six_brokenpkg: using system six:', _system_six) #print('six_brokenpkg: using system six:', _system_six)
except ImportError: except ImportError:
print('six_brokenpkg: no system six available') #print('six_brokenpkg: no system six available')
_system_six = None _system_six = None
if _system_six: if _system_six:

@ -54,8 +54,13 @@ class ActivationTest(testlib.RouterMixin, testlib.TestCase):
l1 = self.router.fork() l1 = self.router.fork()
l2 = self.router.fork() l2 = self.router.fork()
l1.call_service(MyService, 'get_id') # force framework activation l1.call_service(MyService, 'get_id') # force framework activation
capture = testlib.LogCapturer()
capture.start()
try:
exc = self.assertRaises(mitogen.core.CallError, exc = self.assertRaises(mitogen.core.CallError,
lambda: l2.call(call_service_in, l1, MyService2.name(), 'get_id')) lambda: l2.call(call_service_in, l1, MyService2.name(), 'get_id'))
finally:
capture.stop()
msg = mitogen.service.Activator.not_active_msg % (MyService2.name(),) msg = mitogen.service.Activator.not_active_msg % (MyService2.name(),)
self.assertTrue(msg in exc.args[0]) self.assertTrue(msg in exc.args[0])
@ -80,8 +85,13 @@ class PermissionTest(testlib.RouterMixin, testlib.TestCase):
l1 = self.router.fork() l1 = self.router.fork()
l1.call_service(MyService, 'get_id') l1.call_service(MyService, 'get_id')
l2 = self.router.fork() l2 = self.router.fork()
capture = testlib.LogCapturer()
capture.start()
try:
exc = self.assertRaises(mitogen.core.CallError, lambda: exc = self.assertRaises(mitogen.core.CallError, lambda:
l2.call(call_service_in, l1, MyService.name(), 'privileged_op')) l2.call(call_service_in, l1, MyService.name(), 'privileged_op'))
finally:
capture.stop()
msg = mitogen.service.Invoker.unauthorized_msg % ( msg = mitogen.service.Invoker.unauthorized_msg % (
u'privileged_op', u'privileged_op',
MyService.name(), MyService.name(),

@ -13,6 +13,7 @@ import testlib
def roundtrip(*args): def roundtrip(*args):
return args return args
class TwoThreeCompatTest(testlib.RouterMixin, testlib.TestCase): class TwoThreeCompatTest(testlib.RouterMixin, testlib.TestCase):
if mitogen.core.PY3: if mitogen.core.PY3:
python_path = 'python2' python_path = 'python2'

@ -62,9 +62,17 @@ class ListenerTest(testlib.RouterMixin, testlib.TestCase):
def test_constructor_basic(self): def test_constructor_basic(self):
listener = self.klass(router=self.router) listener = self.klass(router=self.router)
capture = testlib.LogCapturer()
capture.start()
try:
self.assertFalse(mitogen.unix.is_path_dead(listener.path)) self.assertFalse(mitogen.unix.is_path_dead(listener.path))
os.unlink(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): class ClientTest(testlib.TestCase):
klass = mitogen.unix.Listener klass = mitogen.unix.Listener

Loading…
Cancel
Save