def create_cruise_control_builds(config, pattern): if pattern == None: pattern = "log.*.xml" builds_obj = Builds() builds = list() all_necessary_files = os.filter_by_days(config.logdir(), pattern, config.days()) for eachfile in all_necessary_files: if None != re.match(pattern, eachfile): try: build = Build.from_file(config.logfile(eachfile)) build.project_id = config.id builds.append(build) except Exception, e: logging.getLogger("ianalyse_logger").error(e) pass
def select_values_from(config, pattern): if pattern == None: pattern = "log.*.xml" values = [] if config.isCruise(): return values all_necessary_files = os.filter_by_days(config.logdir(), "log([0-9]*).*.xml", config.days()) plugins = Plugins.INSTANCE() for eachfile in all_necessary_files: if None != re.match(pattern, eachfile): try: values.append(Build.select_values(config.logfile(eachfile), config, plugins)) except Exception, e: logging.getLogger("ianalyse_logger").error(e) pass
def test_should_find_files_not_more_than_1_day(self): files = os.filter_by_days(self.root, 'log([0-9]*).*.xml', 1) self.assertEquals('log20080924001513.xml', files[0]) self.assertEquals('log20080924062941.xml', files[2])
def test_should_find_files_not_more_than_1_day(self): files = os.filter_by_days(self.root, 'log([0-9]*).*.xml', None) self.assertEquals(0, len(files))
def test_should_find_files_not_more_than_2_days(self): files = os.filter_by_days(self.root, 'log([0-9]*).*.xml', 2) self.assertEquals('log20080922021338.xml', files[0]) self.assertEquals('log20080924062941.xml', files[5])