def test_shutdown(self): """Shuts down in response to a shutdownMicroprocess message""" for msg in [producerFinished(self), shutdownMicroprocess(self)]: chooser = RecordingChooser().activate() for _ in xrange(0, 10): chooser.next() self.assert_(0 == len(chooser.outboxes["outbox"])) self.assert_(0 == len(chooser.outboxes["signal"])) chooser._deliver(msg, "control") try: for _ in xrange(0, 10): chooser.next() self.fail() except StopIteration: pass self.assert_(0 == len(chooser.outboxes["outbox"])) self.assert_(1 == len(chooser.outboxes["signal"])) received = chooser._collect("signal") self.assert_(msg == received)
def __preroll(self, *arg, **argd): Axon.Scheduler.scheduler.run = Axon.Scheduler.scheduler() chooser = RecordingChooser(*arg, **argd).activate() target = Axon.Component.component().activate() chooser.link((chooser, "outbox"), (target, "inbox")) chooser.link((chooser, "signal"), (target, "control")) execute = Axon.Scheduler.scheduler.run.main() return chooser, target, execute
def test_Instiantiate_WithWinding(self): "__init__ - Creating with winding=true is fine" x = RecordingChooser(winding=True)
def test_Instantiate_NoArgs(self): "__init__ - Creating is fine" x = RecordingChooser()