X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=bin%2Fappliskel%2Ftests%2Flauncher%2FTestLauncherSessionArgs.py;h=20445e9df9a9e2b74cede9ed59863e6946e5485b;hb=4b5dddd5103a6a9121dc80ac45de99f2504e17e1;hp=6c2b08cff65902ef45794da1cc7eea969eeafa90;hpb=94c2796f1baac4e0861c62d8ad4d53abd3b5400a;p=modules%2Fkernel.git diff --git a/bin/appliskel/tests/launcher/TestLauncherSessionArgs.py b/bin/appliskel/tests/launcher/TestLauncherSessionArgs.py index 6c2b08cff..20445e9df 100644 --- a/bin/appliskel/tests/launcher/TestLauncherSessionArgs.py +++ b/bin/appliskel/tests/launcher/TestLauncherSessionArgs.py @@ -30,51 +30,50 @@ logger.level = logging.DEBUG logger.addHandler(logging.StreamHandler()) class TestSessionArgs(unittest.TestCase): - # setUpClass appears in Python 2.7 - @classmethod - def setUpClass(cls): + # + logFile = "log.txt" + # Set some predefined command args and corresponding output messages + hello0 = ["hello.py", "args:outfile="+logFile] + hello0Msg = "Hello!" + hello1 = ["hello.py", "args:you,outfile="+logFile] + hello1Msg = "Hello to: you" + helloToAdd = ["hello.py", "args:add.py,1,2,3,outfile="+logFile] + helloToAddMsg = "Hello to: add.py, 1, 2, 3" + add0 = ["add.py", "args:outfile="+logFile] + add0Msg = "No args!" + add3 = ["add.py", "args:1,2,3,outfile="+logFile] + add3Msg = "1+2+3 = 6" + lines0 = ["lines.py", "args:outfile="+logFile] + lines0Msg = "No files given" + lines2 = ["lines.py", "args:hello.py,add.py,outfile="+logFile] + lines2Msg = "hello.py is 35 lines longadd.py is 37 lines long" + linesUnreadable = ["lines.py", "args:hello.py,add.py,1,2,outfile="+logFile] + linesUnreadableMsg = "hello.py is 35 lines longadd.py is 37 lines longFile '1' cannot be readFile '2' cannot be read" + # + def setUp(self): # Initialize path to SALOME application path_to_launcher = os.getenv("SALOME_LAUNCHER") appli_dir = os.path.dirname(path_to_launcher) envd_dir = os.path.join(appli_dir, "env.d") + sys.path[:0] = [os.path.join(appli_dir, "bin", "salome", "appliskel")] # Configure session startup - cls.SALOME = imp.load_source("SALOME", os.path.join(appli_dir,"salome")) - cls.SALOME_args = ["shell", "--config="+envd_dir] + self.SALOME = imp.load_source("SALOME", os.path.join(appli_dir,"salome")) + self.SALOME_args = ["shell", "--config="+envd_dir] - cls.logFile = "log.txt" sys.stdout = StringIO() - - # Set some predefined command args and corresponding output messages - cls.hello0 = ["hello.py", "args:outfile="+cls.logFile] - cls.hello0Msg = "Hello!" - cls.hello1 = ["hello.py", "args:you,outfile="+cls.logFile] - cls.hello1Msg = "Hello to: you" - cls.helloToAdd = ["hello.py", "args:add.py,1,2,3,outfile="+cls.logFile] - cls.helloToAddMsg = "Hello to: add.py, 1, 2, 3" - cls.add0 = ["add.py", "args:outfile="+cls.logFile] - cls.add0Msg = "No args!" - cls.add3 = ["add.py", "args:1,2,3,outfile="+cls.logFile] - cls.add3Msg = "1+2+3 = 6" - cls.lines0 = ["lines.py", "args:outfile="+cls.logFile] - cls.lines0Msg = "No files given" - cls.lines2 = ["lines.py", "args:hello.py,add.py,outfile="+cls.logFile] - cls.lines2Msg = "hello.py is 35 lines longadd.py is 37 lines long" - cls.linesUnreadable = ["lines.py", "args:hello.py,add.py,1,2,outfile="+cls.logFile] - cls.linesUnreadableMsg = "hello.py is 35 lines longadd.py is 37 lines longFile '1' cannot be readFile '2' cannot be read" - # - @classmethod - def tearDownClass(cls): - pass - # - def setUp(self): self.removeLogFile() # def tearDown(self): self.removeLogFile() # def session(self, args=[]): - self.SALOME.main(self.SALOME_args + args) + try: + self.SALOME.main(self.SALOME_args + args) + except SystemExit, e: + if str(e) != '0': + logger.error(e) + pass # def removeLogFile(self): try: