def test_hub_exceptions (self): debug.hub_exceptions(True) server = convenience.listen(('0.0.0.0', 0)) client = convenience.connect(('127.0.0.1', server.getsockname()[1])) client_2, addr = server.accept() def hurl (s): s.recv(1) {}[1] # keyerror fake = StringIO() orig = sys.stderr sys.stderr = fake try: gt = evy.spawn(hurl, client_2) sleep(0) client.send(s2b(' ')) sleep(0) # allow the "hurl" greenlet to trigger the KeyError # not sure why the extra context switch is needed sleep(0) finally: sys.stderr = orig self.assertRaises(KeyError, gt.wait) debug.hub_exceptions(False) # look for the KeyError exception in the traceback self.assert_('KeyError: 1' in fake.getvalue(), "Traceback not in:\n" + fake.getvalue())
def test_everything (self): debug.hub_exceptions(True) debug.hub_exceptions(False) debug.tpool_exceptions(True) debug.tpool_exceptions(False) debug.hub_timer_stacks(True) debug.hub_timer_stacks(False) debug.format_hub_listeners() debug.format_hub_timers()
def tearDown(self): super(TestConvenience, self).tearDown() from evy.tools import debug debug.hub_exceptions(True)
def setUp(self): super(TestConvenience, self).setUp() from evy.tools import debug debug.hub_exceptions(False)
def tearDown (self): super(TestConvenience, self).tearDown() from evy.tools import debug debug.hub_exceptions(True)
def setUp (self): super(TestConvenience, self).setUp() from evy.tools import debug debug.hub_exceptions(False)