00001 #!/usr/local/bin/python 00002 # 00003 # Copyright 2002 00004 # by 00005 # The Board of Trustees of the 00006 # Leland Stanford Junior University. 00007 # All rights reserved. 00008 # 00009 00010 __facility__ = "Online" 00011 __abstract__ = "Example test suite" 00012 __author__ = "S. Tuvi <stuvi@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online" 00013 __date__ = ("$Date: 2005/10/26 01:40:22 $").split(' ')[1] 00014 __version__ = "$Revision: 1.1 $" 00015 __credits__ = "SLAC" 00016 00017 import LATTE.copyright_SLAC 00018 00019 from LATTE.runcontrol.rcSuite import rcSuite 00020 import logging as log 00021 import os 00022 00023 00024 class userSuite(rcSuite): 00025 "Implmentation class for a user application" 00026 def __init__(self, gui, userId, debug): 00027 rcSuite.__init__(self, gui, userId, debug) 00028 log.debug("userSuite.__init__()") 00029 00030 def getName(self): 00031 return __name__ 00032 00033 def setupSuite(self): 00034 pass 00035 00036 def startSuite(self): 00037 try: 00038 sessionContext = {"test":"abc", "eventCount":3} 00039 # The following script will change the value of session var "test" 00040 appDir = self.gui.preferences()['appdir'] 00041 sessionStateAfterTest1 = self.scriptRun(module=os.path.join(appDir,'testSAppCal_Lean'), 00042 context=sessionContext) 00043 log.info("In %s: SESSION VAR=%s" % (self.getName(), self.getSessionVar("test"))) 00044 # The following script will print the value of session var "test" and modify it 00045 sessionStateAfterTest2 = self.scriptRun(module=os.path.join(appDir,'testSAppEvt')) 00046 # Finally let's print the value of the session var "test" here 00047 print sessionStateAfterTest1 00048 print sessionStateAfterTest2 00049 log.info("In %s: SESSION VAR=%s" % (self.getName(), self.getSessionVar("test"))) 00050 except rcSuite.StopRequestedException, e: 00051 log.info("%s, suite: %s, module: %s" % (e.msg, e.suite, e.module)) 00052 if self.getSuite() is not None: 00053 raise e 00054 00055 if self.gui is not None and self.getSuite() is None: 00056 # Stop the suite if it wasn't called from a parent suite 00057 self.gui.doStopRun() 00058 00059 00060 def stopSuite(self): 00061 log.info("End of suite 2")