Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def handle_read_event(self):
raise asyncore.ExitNow()
def test_reraised(self):
from waitress.wasyncore import ExitNow
inst = DummyDispatcher(ExitNow)
self.assertRaises(ExitNow, self._callFUT, inst)
self.assertTrue(inst.write_event_handled)
self.assertFalse(inst.error_handled)
def test_reraised(self):
from waitress.wasyncore import ExitNow
inst = DummyDispatcher(ExitNow)
self.assertRaises(ExitNow, self._callFUT, inst)
self.assertTrue(inst.read_event_handled)
self.assertFalse(inst.error_handled)
def test_readwriteexc(self):
# Check exception handling behavior of read, write and _exception
# check that ExitNow exceptions in the object handler method
# bubbles all the way up through asyncore read/write/_exception calls
tr1 = exitingdummy()
self.assertRaises(asyncore.ExitNow, asyncore.read, tr1)
self.assertRaises(asyncore.ExitNow, asyncore.write, tr1)
self.assertRaises(asyncore.ExitNow, asyncore._exception, tr1)
# check that an exception other than ExitNow in the object handler
# method causes the handle_error method to get called
tr2 = crashingdummy()
asyncore.read(tr2)
self.assertEqual(tr2.error_handled, True)
tr2 = crashingdummy()
asyncore.write(tr2)
self.assertEqual(tr2.error_handled, True)
tr2 = crashingdummy()
asyncore._exception(tr2)
self.assertEqual(tr2.error_handled, True)
def test_exception_in_reraised(self):
from waitress import wasyncore
flags = 0
flags |= select.POLLIN
inst = DummyDispatcher(wasyncore.ExitNow)
self.assertRaises(wasyncore.ExitNow, self._callFUT, inst, flags)
self.assertTrue(inst.read_event_handled)
def test_reraised(self):
from waitress.wasyncore import ExitNow
inst = DummyDispatcher(ExitNow)
self.assertRaises(ExitNow, self._callFUT, inst)
self.assertTrue(inst.read_event_handled)
self.assertFalse(inst.error_handled)
def test_exception_in_reraised(self):
from waitress import wasyncore
flags = 0
flags |= select.POLLIN
inst = DummyDispatcher(wasyncore.ExitNow)
self.assertRaises(wasyncore.ExitNow, self._callFUT, inst, flags)
self.assertTrue(inst.read_event_handled)
def test_reraised(self):
from waitress.wasyncore import ExitNow
inst = DummyDispatcher(ExitNow)
self.assertRaises(ExitNow, self._callFUT, inst)
self.assertTrue(inst.write_event_handled)
self.assertFalse(inst.error_handled)