Trees | Indices | Help |
|
---|
|
1 #coding: utf8 2 # 3 # Project: The EDNA Kernel 4 # http://www.edna-site.org 5 # 6 # File: "$Id$" 7 # 8 # Copyright (C) 2008-2009 European Synchrotron Radiation Facility 9 # Grenoble, France 10 # 11 # Principal authors: Marie-Francoise Incardona (incardon@esrf.fr) 12 # Olof Svensson (svensson@esrf.fr) 13 # Jérôme Kieffer 14 # 15 # This program is free software: you can redistribute it and/or modify 16 # it under the terms of the GNU Lesser General Public License as published 17 # by the Free Software Foundation, either version 3 of the License, or 18 # (at your option) any later version. 19 # 20 # This program is distributed in the hope that it will be useful, 21 # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 # GNU Lesser General Public License for more details. 24 # 25 # You should have received a copy of the GNU General Public License 26 # and the GNU Lesser General Public License along with this program. 27 # If not, see <http://www.gnu.org/licenses/>. 28 # 29 30 __authors__ = [ "Marie-Francoise Incardona", "Olof Svensson", "Jérôme Kieffer" ] 31 __contact__ = "svensson@esrf.fr" 32 __license__ = "LGPLv3+" 33 __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France" 34 __date__ = "20120216" 35 36 import os, sys, time 37 38 from EDVerbose import EDVerbose 39 from EDCommandLine import EDCommandLine 40 from EDUtilsTest import EDUtilsTest 41 from EDApplication import EDApplication 42 from EDTestSuite import EDTestSuite 43 44 4547 """ 48 Some DocStrings ? 49 """ 50 TEST_LABEL = "--test" 51 QUIET_LABEL = "--quiet" 52 57 5812060 """ 61 Scans the command line. 62 """ 63 EDVerbose.DEBUG("EDTestLauncher.preProcess") 64 edCommandLine = EDCommandLine(sys.argv) 65 EDVerbose.log(self.getEdCommandLine().getCommandLine()) 66 self.processCommandLineDebugVerboseLogFile() 67 bContinue = True 68 strTestName = edCommandLine.getArgument(EDTestLauncher.TEST_LABEL) 69 EDVerbose.DEBUG("EDTestLauncher.preProcess: test name = %r" % strTestName) 70 if (strTestName is None): 71 EDVerbose.screen("ERROR - no --test argument found") 72 bContinue = False 73 else: 74 self.__edTestCase = EDUtilsTest.getFactoryPluginTest().loadPlugin(strTestName) 75 if (bContinue): 76 # Determine the base directory 77 if(self.getBaseDir() is None): 78 self.processCommandLineBaseDirectory() 79 # Create the application working directory 80 strApplicationInstanceName = strTestName + "_" + time.strftime("%Y%m%d-%H%M%S", time.localtime()) 81 if(self.getWorkingDir() is None): 82 self.setWorkingDir(strApplicationInstanceName) 83 self.createApplicationWorkingDirectory() 84 # Set the name of the log file 85 EDVerbose.setLogFileName(os.path.join(self.getBaseDir(), strApplicationInstanceName + ".log")) 86 # The check for --quiet and --DEBUG should ideally be placed elsewhere, 87 # for example in EDApplication. 88 if (edCommandLine.existCommand(EDTestLauncher.QUIET_LABEL)): 89 EDVerbose.setVerboseOff() 90 EDVerbose.setTestOff() 91 if (edCommandLine.existCommand(EDApplication.DEBUG_PARAM_LABEL_1) or \ 92 edCommandLine.existCommand(EDApplication.DEBUG_PARAM_LABEL_2)): 93 EDVerbose.setVerboseDebugOn() 94 EDVerbose.DEBUG("EDTestLauncher.preProcess: Debug mode")95 96 9799 """ 100 Executes the test case / test suite 101 """ 102 EDVerbose.DEBUG("EDTestLauncher.process") 103 if (self.__edTestCase is not None): 104 EDVerbose.DEBUG("EDTestLauncher.process: launching test : %s" % self.__edTestCase.getTestName()) 105 self.__edTestCase.execute()106 107109 """ 110 Returns True if the number of failures (test methods and test cases) is 0. 111 Returns False if the number of failures (test methods and test cases) is different than 0. 112 Returns None if there's no test case or test suite defined. 113 """ 114 bValue = None 115 if (self.__edTestCase is not None): 116 bValue = self.__edTestCase.getNumberTestMethodFailure() != 0 117 if isinstance(self.__edTestCase, EDTestSuite): 118 bValue = bValue or (self.__edTestCase.getNumberTestCaseFailure() != 0) 119 return bValue
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Fri Jun 20 03:53:33 2014 | http://epydoc.sourceforge.net |