BioImager  4.9.0
A .NET microscopy imaging application based on Bio library. Supports various microscopes by using imported libraries & GUI automation. Supports XInput game controllers to move stage, take images, run ImageJ macros on images or Bio C# scripts.
Loading...
Searching...
No Matches
microscope.testsuite.test_client.TestClient Class Reference
Inheritance diagram for microscope.testsuite.test_client.TestClient:

Public Member Functions

 setUp (self)
 
 tearDown (self)
 
 test_property_access (self)
 
 test_property_writing (self)
 

Public Attributes

 daemon = Pyro4.Daemon()
 
 thread = threading.Thread(target=self.daemon.requestLoop)
 

Protected Member Functions

 _serve_objs (self, objs)
 

Detailed Description

Definition at line 65 of file test_client.py.

Member Function Documentation

◆ _serve_objs()

microscope.testsuite.test_client.TestClient._serve_objs ( self,
objs )
protected

Definition at line 74 of file test_client.py.

74 def _serve_objs(self, objs):
75 uris = [self.daemon.register(obj) for obj in objs]
76 self.thread.start()
77 clients = [microscope.clients.Client(uri) for uri in uris]
78 return clients
79

◆ setUp()

microscope.testsuite.test_client.TestClient.setUp ( self)

Definition at line 66 of file test_client.py.

66 def setUp(self):
67 self.daemon = Pyro4.Daemon()
68 self.thread = threading.Thread(target=self.daemon.requestLoop)
69

◆ tearDown()

microscope.testsuite.test_client.TestClient.tearDown ( self)

Definition at line 70 of file test_client.py.

70 def tearDown(self):
71 self.daemon.shutdown()
72 self.thread.join()
73

◆ test_property_access()

microscope.testsuite.test_client.TestClient.test_property_access ( self)
Test we can read properties via the Client

Definition at line 80 of file test_client.py.

80 def test_property_access(self):
81 """Test we can read properties via the Client"""
82 # list of (object-to-serve, property-name-to-test)
83 objs2prop = [
84 (PyroService(), "attr"),
85 (ExposedDeformableMirror(10), "n_actuators"),
86 ]
87 clients = self._serve_objs([x[0] for x in objs2prop])
88 for client, obj_prop in zip(clients, objs2prop):
89 obj = obj_prop[0]
90 name = obj_prop[1]
91 self.assertTrue(getattr(client, name), getattr(obj, name))
92

◆ test_property_writing()

microscope.testsuite.test_client.TestClient.test_property_writing ( self)
Test we can write properties via the Client

Definition at line 93 of file test_client.py.

93 def test_property_writing(self):
94 """Test we can write properties via the Client"""
95 obj = PyroService()
96 client = (self._serve_objs([obj]))[0]
97 self.assertTrue(client.attr, 42)
98 client.attr = 10
99 self.assertTrue(client.attr, 10)
100 self.assertTrue(obj.attr, 10)
101
102

Member Data Documentation

◆ daemon

microscope.testsuite.test_client.TestClient.daemon = Pyro4.Daemon()

Definition at line 67 of file test_client.py.

◆ thread

microscope.testsuite.test_client.TestClient.thread = threading.Thread(target=self.daemon.requestLoop)

Definition at line 68 of file test_client.py.


The documentation for this class was generated from the following file: