def test_server_resync(self): from pizco import Server app = QApplication([]) srv = RemotePizcoEmitterResync() pizco_srv = Server(srv,rep_endpoint="tcp://127.0.0.1:1211") from threading import Thread import numpy as np from guiqwt.plot import ImageWidget from guiqwt.builder import make import time im = ImageWidget() im.register_all_curve_tools() ts = TestSync() def test_thread(): ts.initialize_subobject(im) srv.std_signal.connect(ts.receiver_int) v_int = 0 while True: v_int += 1 srv.emission() time.sleep(0.5) if v_int==5: break im.close() t = Thread(None,test_thread) t.start() im.show() app.exec_() pizco_srv.stop() assert(ts._internal_value != 0)
def test_server_resync(self): from pizco import Server app = QApplication([]) srv = RemotePizcoEmitterResync() pizco_srv = Server(srv, rep_endpoint="tcp://127.0.0.1:1211") from threading import Thread import numpy as np from guiqwt.plot import ImageWidget from guiqwt.builder import make import time im = ImageWidget() im.register_all_curve_tools() ts = TestSync() def test_thread(): ts.initialize_subobject(im) srv.std_signal.connect(ts.receiver_int) v_int = 0 while True: v_int += 1 srv.emission() time.sleep(0.5) if v_int == 5: break im.close() t = Thread(None, test_thread) t.start() im.show() app.exec_() pizco_srv.stop() assert (ts._internal_value != 0)
def test_future(self): s = Server(Example()) proxy = Proxy(s.rep_endpoint) fut = proxy.fut() self.assertEqual(fut.result(), 10) fut = proxy.fut_raise() self.assertIsInstance(fut.exception(), ValueError) fut = proxy.fut_raise() self.assertRaises(ValueError, fut.result) proxy._proxy_stop_me() s.stop()