Example #1
0
    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)
Example #2
0
 def setUp(self):
     self.emitter = zstreams.Emitter("ipc:///tmp/subtest")
     self.subscriber = zstreams.Subscriber("ipc:///tmp/subtest")
     self.emitter.connect()
     self.subscriber.connect()
Example #3
0
 def test_publish_before_connecting(self):
     emitter = zstreams.Emitter("ipc:///tmp/emitter_test_doesnt_exist")
     with self.assertRaises(excs.NotConnected):
         emitter.publish("test_topic", b"foo")
Example #4
0
 def test_send_before_connecting(self):
     emitter = zstreams.Emitter("ipc:///tmp/emitter_test_doesnt_exist")
     with self.assertRaises(excs.NotConnected):
         emitter.send("foo")
Example #5
0
 def setUp(self):
     self.emitter = zstreams.Emitter("ipc:///tmp/emitter_test")
     self.emitter.connect()