def test_proxy_constructor_raises_exception_if_actor_is_dead(self): actor_ref = self.AnActor.start() actor_ref.stop() try: ActorProxy(actor_ref) self.fail('Should raise ActorDeadError') except ActorDeadError as exception: self.assertEqual('%s not found' % actor_ref, str(exception))
def proxy(self): """ Wraps the :class:`ActorRef` in an :class:`ActorProxy <pykka.ActorProxy>`. Using this method like this:: proxy = AnActor.start().proxy() is analogous to:: proxy = ActorProxy(AnActor.start()) :raise: :exc:`pykka.ActorDeadError` if actor is not available :return: :class:`pykka.ActorProxy` """ return ActorProxy(self)
def setUp(self): self.proxy = ActorProxy(self.AnActor.start())