def configure(self, options, config): if hasattr(options, self.enableOpt): if not getattr(options, self.enableOpt): self.enabled = False return else: self.enabled = True self.logformat = logging.Formatter("%(asctime)s - %(levelname)s - " + "%(name)s - %(message)s") if options.debug_log: self.logger = logging.getLogger("NoseTestExecuteEngine") self.debug_stream = logging.FileHandler(options.debug_log) self.debug_stream.setFormatter(self.logformat) self.logger.addHandler(self.debug_stream) self.logger.setLevel(logging.DEBUG) if options.result_log: ch = logging.StreamHandler() ch.setLevel(logging.ERROR) ch.setFormatter(self.logformat) self.logger.addHandler(ch) self.result_stream = open(options.result_log, "w") else: self.result_stream = sys.stdout deploy = deployDataCenter.deployDataCenters(options.config) deploy.loadCfg() if options.load else deploy.deploy() self.setClient(deploy.testClient) self.setConfig(deploy.getCfg()) self.testrunner = nose.core.TextTestRunner(stream=self.result_stream, descriptions=True, verbosity=2, config=config)
def configure(self, options, config): self.enabled = 1 self.enableOpt = "--with-marvin" self.logformat = logging.Formatter("%(asctime)s - %(levelname)s - %(name)s - %(message)s") if options.debug_log: self.logger = logging.getLogger("NoseTestExecuteEngine") self.debug_stream = logging.FileHandler(options.debug_log) self.debug_stream.setFormatter(self.logformat) self.logger.addHandler(self.debug_stream) self.logger.setLevel(logging.DEBUG) if options.result_log: ch = logging.StreamHandler() ch.setLevel(logging.ERROR) ch.setFormatter(self.logformat) self.logger.addHandler(ch) self.result_stream = open(options.result_log, "w") else: self.result_stream = sys.stdout deploy = deployDataCenter.deployDataCenters(options.config) deploy.loadCfg() if options.load else deploy.deploy() self.setClient(deploy.testClient) self.setConfig(deploy.getCfg()) cfg = nose.config.Config() cfg.logStream = self.result_stream cfg.debugLog = self.debug_stream self.testrunner = nose.core.TextTestRunner( stream=self.result_stream, descriptions=True, verbosity=2, config=config )
def __deployDC(self): try: ''' Deploy the DataCenter and retrieves test client. ''' deploy_obj = deployDataCenters(self.__parsedConfig, self.__tcRunLogger) if self.__loadFlag: deploy_obj.loadCfg() else: deploy_obj.deploy() self.__testClient = deploy_obj.testClient return SUCCESS except Exception, e: print "\n Exception Occurred Under __deployDC : %s" % str(e) return None
def configure(self, options, config): """enable the marvin plugin when the --with-marvin directive is given to nose. The enableOpt value is set from the command line directive and self.enabled (True|False) determines whether marvin's tests will run. By default non-default plugins like marvin will be disabled """ if hasattr(options, self.enableOpt): if not getattr(options, self.enableOpt): self.enabled = False return else: self.enabled = True self.logformat = logging.Formatter("%(asctime)s - %(levelname)s - " + "%(name)s - %(message)s") if options.debug_log: self.logger = logging.getLogger("NoseTestExecuteEngine") self.debug_stream = logging.FileHandler(options.debug_log) self.debug_stream.setFormatter(self.logformat) self.logger.addHandler(self.debug_stream) self.logger.setLevel(logging.DEBUG) if options.result_log: ch = logging.StreamHandler() ch.setLevel(logging.ERROR) ch.setFormatter(self.logformat) self.logger.addHandler(ch) self.result_stream = open(options.result_log, "w") else: self.result_stream = sys.stdout deploy = deployDataCenter.deployDataCenters(options.config_file) deploy.loadCfg() if options.load else deploy.deploy() self.setClient(deploy.testClient) self.setConfig(deploy.getCfg()) self.testrunner = nose.core.TextTestRunner(stream=self.result_stream, descriptions=True, verbosity=2, config=config)