def test_creation(self): """ Doesn't even try to acquire an image, just create and delete components """ if TEST_NOHW: self.skipTest("No hardware present") sem = tescan.SEM(**CONFIG_SEM) self.assertEqual(len(sem.children.value), 6) for child in sem.children.value: if child.name == CONFIG_SED["name"]: sed = child elif child.name == CONFIG_SCANNER["name"]: scanner = child elif child.name == CONFIG_STG["name"]: stage = child elif child.name == CONFIG_FOCUS["name"]: focus = child elif child.name == CONFIG_CM["name"]: camera = child elif child.name == CONFIG_PRESSURE["name"]: pressure = child self.assertEqual(len(scanner.resolution.value), 2) self.assertIsInstance(sed.data, model.DataFlow) self.assertTrue(sem.selfTest(), "SEM self test failed.") sem.terminate()
def setUpClass(cls): if TEST_NOHW: return cls.sem = tescan.SEM(**CONFIG_SEM) for child in cls.sem.children.value: if child.name == CONFIG_SED["name"]: cls.sed = child elif child.name == CONFIG_SCANNER["name"]: cls.scanner = child elif child.name == CONFIG_STG["name"]: cls.stage = child elif child.name == CONFIG_FOCUS["name"]: cls.focus = child elif child.name == CONFIG_CM["name"]: cls.camera = child elif child.name == CONFIG_PRESSURE["name"]: cls.pressure = child
def test_pickle(self): if TEST_NOHW: self.skipTest("No hardware present") try: os.remove("test") except OSError: pass daemon = Pyro4.Daemon(unixsocket="test") sem = tescan.SEM(daemon=daemon, **CONFIG_SEM) dump = pickle.dumps(sem, pickle.HIGHEST_PROTOCOL) # print "dump size is", len(dump) sem_unpickled = pickle.loads(dump) self.assertIsInstance(sem_unpickled.children, model.VigilantAttributeBase) self.assertEqual(sem_unpickled.name, sem.name) sem.terminate() daemon.shutdown()
def setUpClass(cls): if TEST_NOHW: return cls.sem = tescan.SEM(**cls.CONFIG_HW) for child in cls.sem.children.value: if child.name == CONFIG_SED["name"]: cls.sed = child elif child.name == CONFIG_SCANNER["name"]: cls.scanner = child elif child.name == CONFIG_STG["name"]: cls.stage = child elif child.name == CONFIG_FOCUS["name"]: cls.focus = child # Doesn't seem to work with the simulator elif child.name == CONFIG_CM["name"]: cls.camera = child elif child.name == CONFIG_PRESSURE["name"]: cls.pressure = child elif child.name == CONFIG_LIGHT["name"]: cls.light = child