Exemplo n.º 1
0
 def dclInterface(self):
     Tree('pytree',-1,'ReadOnly').createPulse(self.shot)
     self.assertEqual(dcl('help set verify',1,1,0)[1],None)
     self.assertEqual(tcl('help set tree',1,1,0)[1],None)
     self.assertEqual(ccl('help set xandq',1,1,0)[1],None)
     self.assertEqual(cts('help addcrate',1,1,0)[1],None)
     """ tcl commands """
     self._doTCLTest('type test','test\n')
     self._doTCLTest('close/all')
     self._doTCLTest('show db','\n')
     self._doTCLTest('set tree pytree/shot=%d'%(self.shot,))
     self._doTCLTest('show db','000  PYTREE        shot: %d [\\PYTREE::TOP]   \n\n'%self.shot)
     self._doTCLTest('edit PYTREE/shot=%d'%(self.shot,))
     self._doTCLTest('add node TCL_NUM/usage=numeric')
     self._doTCLTest('add node TCL_PY_DEV/model=TESTDEVICE')
     self._doTCLTest('do TESTDEVICE:TASK_TEST')
     self._doExceptionTest('do TESTDEVICE:TASK_ERROR',Exc.DevUNKOWN_STATE)
     if not sys.platform.startswith('win'): # Windows does not support timeout yet
         self._doExceptionTest('do TESTDEVICE:TASK_TIMEOUT',Exc.TdiTIMEOUT)
     self._doExceptionTest('close',Exc.TreeWRITEFIRST)
     self._doTCLTest('write')
     self._doTCLTest('close')
     self._doTCLTest('show db','\n')
     """ context """
     self._doTCLTest('set tree pytree')
     pytree = Tree()
     self.assertEqual(str(pytree),'Tree("PYTREE",-1,"Normal")')
     self._doTCLTest('close pytree')
     self.assertEqual(str(pytree),'Tree("PYTREE",-1,"Closed")')
     """ tcl exceptions """
     self._doExceptionTest('close',Exc.TreeNOT_OPEN)
     self._doExceptionTest('dispatch/command/server=xXxXxXx type test',Exc.ServerPATH_DOWN)
     self._doExceptionTest('dispatch/command/server type test',Exc.MdsdclIVVERB)
Exemplo n.º 2
0
 def interface(self):
     with Tree(self.tree,self.shot,'new') as pytree:
         Device.PyDevice('TestDevice').Add(pytree,'TESTDEVICE_I')
         Device.PyDevice('TestDevice').Add(pytree,'TESTDEVICE_S')
         pytree.write()
     pytree.normal()
     self.assertEqual(pytree.TESTDEVICE_S.check_source(),"No source stored in record.")
     pytree.TESTDEVICE_S._update_source()
     self.assertEqual(pytree.TESTDEVICE_S.check_source(),"")
     pytree.close() # needed for windows to release file lock
     self.assertEqual(dcl('help set verify',1,1,0)[1],None)
     self.assertEqual(tcl('help set tree',1,1,0)[1],None)
     self.assertEqual(ccl('help set xandq',1,1,0)[1],None)
     self.assertEqual(cts('help addcrate',1,1,0)[1],None)
     """ tcl commands """
     self._doTCLTest('type test','test\n')
     if self.inThread: Tree.usePrivateCtx(1)
     self._doTCLTest('close/all')
     self._doTCLTest('show db','\n')
     self._doTCLTest('set tree pytree/shot=%d'%(self.shot,))
     self._doTCLTest('show db','000  PYTREE        shot: %d [\\PYTREE::TOP]   \n\n'%self.shot)
     self._doTCLTest('edit PYTREE/shot=%d'%(self.shot,))
     self._doTCLTest('add node TCL_NUM/usage=numeric')
     self._doTCLTest('add node TCL_PY_DEV/model=TESTDEVICE')
     self._doTCLTest('do TESTDEVICE_I:TASK_TEST')
     self._doTCLTest('do TESTDEVICE_S:TASK_TEST')
     self._doTCLTest('do TESTDEVICE_S:ACTIONSERVER:MANUAL')
     self._doExceptionTest('do TESTDEVICE_I:TASK_ERROR1',Exc.DevUNKOWN_STATE) # w/o timeout
     self._doExceptionTest('do TESTDEVICE_S:TASK_ERROR1',Exc.DevUNKOWN_STATE) # w/o timeout
     self._doExceptionTest('do TESTDEVICE_I:TASK_ERROR2',Exc.DevUNKOWN_STATE) # w/  timeout
     self._doExceptionTest('do TESTDEVICE_S:TASK_ERROR2',Exc.DevUNKOWN_STATE) # w/  timeout
     self._doExceptionTest('close',Exc.TreeWRITEFIRST)
     self._doTCLTest('write')
     self._doTCLTest('close')
     self._doTCLTest('show db','\n')
     """ context """
     self._doTCLTest('set tree pytree/shot=%d'%(self.shot,))
     pytree = Tree()
     self.assertEqual(str(pytree),'Tree("PYTREE",%d,"Normal")'%self.shot)
     self._doTCLTest('close pytree/shot=%d'%(self.shot,))
     self.assertEqual(str(pytree),'Tree("?",?,"Closed")')
     if self.inThread: Tree.usePrivateCtx(0)
     """ tcl exceptions """
     self._doExceptionTest('close',Exc.TreeNOT_OPEN)
     self._doExceptionTest('dispatch/command/server=xXxXxXx type test',Exc.ServerPATH_DOWN)
     self._doExceptionTest('dispatch/command/server type test',Exc.MdsdclIVVERB)
Exemplo n.º 3
0
 def test():
     Tree('pytree', -1, 'ReadOnly').createPulse(self.shot)
     self.assertEqual(dcl('help set verify', 1, 1, 0)[1], None)
     self.assertEqual(tcl('help set tree', 1, 1, 0)[1], None)
     self.assertEqual(ccl('help set xandq', 1, 1, 0)[1], None)
     self.assertEqual(cts('help addcrate', 1, 1, 0)[1], None)
     """ tcl commands """
     self._doTCLTest('type test', 'test\n')
     if self.inThread: Tree.usePrivateCtx(1)
     self._doTCLTest('close/all')
     self._doTCLTest('show db', '\n')
     self._doTCLTest('set tree pytree/shot=%d' % (self.shot, ))
     self._doTCLTest(
         'show db',
         '000  PYTREE        shot: %d [\\PYTREE::TOP]   \n\n' %
         self.shot)
     self._doTCLTest('edit PYTREE/shot=%d' % (self.shot, ))
     self._doTCLTest('add node TCL_NUM/usage=numeric')
     self._doTCLTest('add node TCL_PY_DEV/model=TESTDEVICE')
     self._doTCLTest('do TESTDEVICE:TASK_TEST')
     self._doExceptionTest('do TESTDEVICE:TASK_ERROR1',
                           Exc.DevUNKOWN_STATE)
     self._doExceptionTest('do TESTDEVICE:TASK_ERROR2',
                           Exc.DevUNKOWN_STATE)
     self._doExceptionTest('close', Exc.TreeWRITEFIRST)
     self._doTCLTest('write')
     self._doTCLTest('close')
     self._doTCLTest('show db', '\n')
     """ context """
     self._doTCLTest('set tree pytree')
     pytree = Tree()
     self.assertEqual(str(pytree), 'Tree("PYTREE",-1,"Normal")')
     self._doTCLTest('close pytree')
     self.assertEqual(str(pytree), 'Tree("PYTREE",-1,"Closed")')
     if self.inThread: Tree.usePrivateCtx(0)
     """ tcl exceptions """
     self._doExceptionTest('close', Exc.TreeNOT_OPEN)
     self._doExceptionTest('dispatch/command/server=xXxXxXx type test',
                           Exc.ServerPATH_DOWN)
     self._doExceptionTest('dispatch/command/server type test',
                           Exc.MdsdclIVVERB)