How to use the waitress.wasyncore.ExitNow function in waitress

To help you get started, we’ve selected a few waitress examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Pylons / waitress / tests / test_wasyncore.py View on Github external
def handle_read_event(self):
        raise asyncore.ExitNow()
github Pylons / waitress / tests / test_wasyncore.py View on Github external
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)
github Pylons / waitress / tests / test_wasyncore.py View on Github external
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)
github Pylons / waitress / tests / test_wasyncore.py View on Github external
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)
github Pylons / waitress / tests / test_wasyncore.py View on Github external
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)
github Pylons / waitress / tests / test_wasyncore.py View on Github external
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)
github Pylons / waitress / tests / test_wasyncore.py View on Github external
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)
github Pylons / waitress / tests / test_wasyncore.py View on Github external
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)