def setUp(self): self.root = server.BaseServer(share.SharingManager()) storage.Storage(parent=self.root) self.obj = instrument.Instrument(self.root, 'instrument') dumps(self.obj) self.obj.outFile = False # Create a device server with some sub-devices self.dsrv = device.DeviceServer(self.root, 'dsrv') self.root.deviceservers = [self.dsrv] self.dev1 = device.Device(self.dsrv, 'dev1') self.dev2 = device.Device(self.dsrv, 'dev2') self.assertEqual(len(self.dsrv.devices), 2) set_options(self.dev1) set_options(self.dev2) set_options(self.obj) # self.obj.devices=[self.dev1,self.dev2] self.obj.measure['measureFile'] = hdfpath d = {} ao(d, 'dev1role', 'Role', ['/dsrv/dev1/', 'default']) ao(d, 'dev2role', 'Role', ['/dsrv/dev2/', 'default']) self.obj.desc.update(d) self.d = d self.obj.init_instrument()
def setUp(self): self.root = device.Device() self.root.deviceservers = [] self.root.pause_check = lambda *a: 1 self.root.desc.add_option('progress', type='Progress') self.ds = device.DeviceServer(self.root, 'srv') self.dev1 = device.Device(self.ds, 'dev1') self.dev1['dev'] = '/dev/1' self.dev2 = device.Device(self.ds, 'dev2') self.dev2['dev'] = '/dev/2' self.reg = device.DevicePathRegistry()
def test_wiring(self): device.Device(self.nodp, 'dev1') self.nodp.desc.sete('role', { 'current': ['/dev1/', 'default'], 'type': 'Role' }) self.nodp.map_role_dev('role') self.assertIn('digraph', self.nodp.wiring())
def test_model(self): device.Device(self.dp, 'pippo') mod = self.dp.model() self.assertDictEqual({ 'pippo': { 'self': 'device' }, 'self': 'device' }, mod)
def test_noshare(self): from misura.droid import device pickle.dumps(data.Conf()) pickle.dumps(data.CircularBuffer()) obj = self.mgr.Conf() pickle.dumps(obj) obj = self.mgr.CircularBuffer() pickle.dumps(obj) obj = device.Device() pickle.dumps(obj.desc)
def setUp(self): self.d = device.Device() self.d.sete('T', {"type": 'Float', "attr": ['History', 'ReadOnly']}) self.d.sete('rawT', {"type": 'Float', 'unit': 'celsius'}) self.d.sete( 'calibrationT', { "current": [[('Measured', 'Float'), ('Theoretical', 'Float')], [20, 20]], "type": 'Table' }) device.Calibrator(self.d, 'T')
def setUp(self): self.nodp = device.Device() self.dp = device.Device()
def test_list(self): self.assertEqual(self.dp.devices, []) device.Device(self.dp, 'dev1') self.dp.dev1['name'] = 'device' v = self.dp.list() self.assertEqual(v, [('device', 'dev1')])