31 """Simple class to test serving via Pyro.
33 We can use one of our own test devices but the idea is to have
34 this tests independent
from the devices. We should be able to
35 test the Client
with any Python object
and weird cases, even
if we
36 don
't yet make use of them in the devices.
47 def attr(self, value):
54 Microscope device server is configure to
not require
@expose but
55 this
is to test our client
with Pyro4
's own Daemon. We need to
56 subclass and have the passthrough because the property comes
from
57 the Abstract Base
class,
not the TestDeformableMirror
class.
61 def n_actuators(self):
62 return super().n_actuators
67 self.
daemon = Pyro4.Daemon()
68 self.
thread = threading.Thread(target=self.
daemon.requestLoop)
74 def _serve_objs(self, objs):
75 uris = [self.
daemon.register(obj)
for obj
in objs]
81 """Test we can read properties via the Client"""
87 clients = self.
_serve_objs([x[0]
for x
in objs2prop])
88 for client, obj_prop
in zip(clients, objs2prop):
91 self.assertTrue(getattr(client, name), getattr(obj, name))
94 """Test we can write properties via the Client"""
97 self.assertTrue(client.attr, 42)
99 self.assertTrue(client.attr, 10)
100 self.assertTrue(obj.attr, 10)
103if __name__ ==
"__main__":
def _serve_objs(self, objs)
def test_property_writing(self)
def test_property_access(self)