def setUp(self): self.vent = zstreams.Ventilator("ipc:///tmp/vent_test") self.sink = zstreams.Sink("ipc:///tmp/sink_test") worker = zstreams.Worker("ipc:///tmp/vent_test") worker_pushr = zstreams.Pusher("ipc:///tmp/sink_test") self.worker = zstreams.CompoundStream(worker, worker_pushr) def run_proxy(): self.worker.stream_in.connect() # TODO: Make special stream type for pusher streams self.worker.stream_out.connect() self.worker.run() self.vent.connect() self.pool = ThreadPoolExecutor(max_workers=1) self.sink.connect() self.pool.submit(run_proxy)
def setUp(self): # Ventilating subscriber rint = random.randint(1, 100) self.emitter = zstreams.Emitter("ipc:///tmp/vent_sub_test") sub = zstreams.Subscriber(f"ipc:///tmp/vent_sub_test") vent = zstreams.Ventilator(f"ipc:///tmp/vent_sub_test_out_{rint}") self.vent_sub = zstreams.CompoundStream(sub, vent) self.worker = zstreams.Worker(f"ipc:///tmp/vent_sub_test_out_{rint}") def run_proxy(): self.vent_sub.stream_in.subscribe("test_topic") self.vent_sub.stream_in.connect() self.vent_sub.stream_out.connect() self.vent_sub.run() self.worker.connect() self.emitter.connect() self.pool = ThreadPoolExecutor(max_workers=1) self.pool.submit(run_proxy)
def test_receive_before_connecting(self): worker = zstreams.Worker("ipc:///tmp/worker_test_doesnt_exist") with self.assertRaises(excs.NotConnected): worker.receive()
def setUp(self): self.vent = zstreams.Ventilator("ipc:///tmp/vent_test") self.vent.connect() self.worker = zstreams.Worker("ipc:///tmp/vent_test") self.worker.connect()