def setUpClass(testZmqIfc): global wasLaunched (status, wasLaunched) = PySpectra.assertPyspMonitorRunning()
def testMoveScanInfo(self): print "testTangoIfc.testMoveScanInfo" if utils.getHostname() != definitions.hostTK: return PySpectra.cls() PySpectra.delete() # # senv ActiveMntGrp mg_pysp # if not utils.runMacro("senv ActiveMntGrp mg_pysp"): print("testTangoIfc.testMoveScanInfo: ruNMacro failed") return # # see, if the pyspMonitor process exists. Otherwise launch it # (status, wasLaunched) = PySpectra.assertPyspMonitorRunning() if not status: print( "testTangoIfc.testMoveScanInfo: failed to launch the pyspMonitor" ) return # # move the motors to good starting points # if not utils.runMacro("umv eh_mot66 50 eh_mot67 12"): print("testTangoIfc.testMoveScanInfo: ruNMacro failed") return # # to the a2scan # if not utils.runMacro("a2scan eh_mot66 50 51 eh_mot67 12 13 40 0.1"): print("testTangoIfc.testMoveScanInfo: ruNMacro failed") return # # the pyspMonitor may still by 'scanning' although # we see that the scan is over. So test 'isAlive' # count = 0 while 1: ret = HasyUtils.toPyspMonitor({'isAlive': True}) if ret['result'] == 'done': break count += 1 time.sleep(0.5) if count > 5: print("testTangoIfc.testMoveScanInfo: isAlive failes") return ret = HasyUtils.toPyspMonitor({'command': 'display sig_gen'}) if ret['result'] != 'done': print( "testTangoIfc.testMoveScanInfo: 'display sig_gen' failed, %s" % repr(ret)) return PySpectra.setTitle("moveStart sig_gen 50.5 False") res = HasyUtils.toPyspMonitor( {'command': 'moveStart sig_gen 50.5 False'}) if res['result'] != 'done': print("testTangoIfc.testMoveScanInfo: moveStart failed failed") return while 1: if HasyUtils.toPyspMonitor({'getDoorState': True})['result'] == 'ON': break time.sleep(0.5) if wasLaunched: print("testTangoIfc.testMoveScanInfo: kill pyspMonitor.py") os.system("kill_proc -f pyspMonitor.py") print "testTangoIfc.testMoveScanInfo DONE" return