def test_skips_registering(self): sock = greenhouse.Socket() poller = greenhouse.scheduler.state.poller poller.register(sock, poller.INMASK | poller.OUTMASK) items = poller._registry.items() poller.register(sock, poller.INMASK) self.assertEquals(poller._registry.items(), items)
def _wait_event(self, timeout=None, write=False): poller = scheduler.state.poller mask = poller.ERRMASK | (poller.OUTMASK if write else poller.INMASK) event = self._writable if write else self._readable try: counter = poller.register(self, mask) except EnvironmentError, error: if error.args[0] in errno.errorcode: raise socket.error(*error.args) raise
def test_register_both_read_and_write(self): with self.socketpair() as (client, handler): poller = greenhouse.scheduler.state.poller counter1 = poller.register(client, poller.INMASK) counter2 = poller.register(client, poller.OUTMASK)