def process_results(self, _): """ Check to see if the test has passed. @ In, ignored, string, output of test. @ Out, None """ #image image_opts = {} if 'rel_err' in self.specs.keys(): image_opts['rel_err'] = self.specs['rel_err'] if 'zero_threshold' in self.specs.keys(): image_opts['zero_threshold'] = self.specs['zero_threshold'] img_diff = ImageDiff(self.specs['test_dir'], self.img_files, **image_opts) (img_same, img_messages) = img_diff.diff() if not img_same: self.set_diff(img_messages) return self.set_success()
def rawProcessResults(self, moose_dir, retcode, options, output): missing = [] for filename in self.check_files: if not os.path.exists(filename): missing.append(filename) if len(missing) > 0: self.setStatus('CWD '+os.getcwd()+' METHOD '+os.environ.get("METHOD","?")+' Expected files not created '+" ".join(missing),self.bucket_fail) return output #csv if len(self.specs["rel_err"]) > 0: csv_diff = CSVDiffer(self.specs['test_dir'],self.csv_files,relative_error=float(self.specs["rel_err"])) else: csv_diff = CSVDiffer(self.specs['test_dir'],self.csv_files) message = csv_diff.diff() if csv_diff.getNumErrors() > 0: self.setStatus(message,self.bucket_diff) return output #unordered csv checkAbsoluteValue = False if len(self.specs["check_absolute_value"]) > 0: if self.specs["check_absolute_value"].lower() in ['true','t']: checkAbsoluteValue = True if len(self.specs["rel_err"]) > 0: ucsv_diff = UnorderedCSVDiffer(self.specs['test_dir'],self.ucsv_files,relative_error=float(self.specs["rel_err"]),absolute_check=checkAbsoluteValue) else: ucsv_diff = UnorderedCSVDiffer(self.specs['test_dir'],self.ucsv_files,absolute_check=checkAbsoluteValue) ucsv_same,ucsv_messages = ucsv_diff.diff() if not ucsv_same: self.setStatus(ucsv_messages, self.bucket_diff) return output #xml xmlopts = {} if len(self.specs["rel_err"]) > 0: xmlopts['rel_err'] = float(self.specs["rel_err"]) xmlopts['zero_threshold'] = float(self.specs["zero_threshold"]) xmlopts['unordered' ] = False xmlopts['remove_whitespace'] = self.specs['remove_whitespace'].lower().strip() == 'true' xmlopts['remove_unicode_identifier'] = self.specs['remove_unicode_identifier'].lower().strip() == 'true' if len(self.specs['xmlopts'])>0: xmlopts['xmlopts'] = self.specs['xmlopts'].split(' ') xml_diff = XMLDiff(self.specs['test_dir'],self.xml_files,**xmlopts) (xml_same,xml_messages) = xml_diff.diff() if not xml_same: self.setStatus(xml_messages, self.bucket_diff) return output #unordered xml xmlopts['unordered'] = True uxml_diff = XMLDiff(self.specs['test_dir'],self.uxml_files,**xmlopts) (uxml_same,uxml_messages) = uxml_diff.diff() if not uxml_same: self.setStatus(uxml_messages, self.bucket_diff) return output #text textOpts = {'comment': self.specs['comment']} textDiff = TextDiff(self.specs['test_dir'],self.text_files,**textOpts) (textSame,textMessages) = textDiff.diff() if not textSame: self.setStatus(textMessages, self.bucket_diff) return output #image imageOpts = {} if 'rel_err' in self.specs.keys(): imageOpts['rel_err' ] = self.specs['rel_err' ] if 'zero_threshold' in self.specs.keys(): imageOpts['zero_threshold'] = self.specs['zero_threshold'] imgDiff = ImageDiff(self.specs['test_dir'],self.img_files,**imageOpts) (imgSame,imgMessages) = imgDiff.diff() if not imgSame: self.setStatus(imgMessages, self.bucket_diff) return output self.setStatus(self.success_message, self.bucket_success) return output