def preProcess(self): """ PreProcess of the execution test: download a set of images from http://www.edna-site.org and remove any existing output file """ EDTestCasePluginExecute.preProcess(self) self.loadTestImage([ "bsa_013_08.ang", "bsa_013_08.dat" ]) strExpectedOutput = self.readAndParseFile (self.getReferenceDataOutputFile()) EDVerbose.DEBUG("strExpectedOutput:" + strExpectedOutput) xsDataResultReference = XSDataResultSaxsCurvesv1_0.parseString(strExpectedOutput) self.refOutput = xsDataResultReference.getOutputDataFile().getPath().getValue() EDVerbose.DEBUG(" Output file is %s" % self.refOutput) if not os.path.isdir(os.path.dirname(self.refOutput)): os.makedirs(os.path.dirname(self.refOutput)) if os.path.isfile(self.refOutput): EDVerbose.DEBUG(" Output file exists %s, I will remove it" % self.refOutput) os.remove(self.refOutput)
def preProcess(self): """ PreProcess of the execution test: download a set of images from http://www.edna-site.org and remove any existing output file """ EDTestCasePluginExecute.preProcess(self) self.loadTestImage(["bsa_013_08.ang", "bsa_013_08.dat"]) strExpectedOutput = self.readAndParseFile( self.getReferenceDataOutputFile()) EDVerbose.DEBUG("strExpectedOutput:" + strExpectedOutput) xsDataResultReference = XSDataResultSaxsCurvesv1_0.parseString( strExpectedOutput) self.refOutput = xsDataResultReference.getOutputDataFile().getPath( ).getValue() EDVerbose.DEBUG(" Output file is %s" % self.refOutput) if not os.path.isdir(os.path.dirname(self.refOutput)): os.makedirs(os.path.dirname(self.refOutput)) if os.path.isfile(self.refOutput): EDVerbose.DEBUG(" Output file exists %s, I will remove it" % self.refOutput) os.remove(self.refOutput)
def testExecute(self): """ """ self.run() plugin = self.getPlugin() strExpectedOutput = self.readAndParseFile (self.getReferenceDataOutputFile()) # strObtainedOutput = self.readAndParseFile (self.m_edObtainedOutputDataFile) EDVerbose.DEBUG("Checking obtained result...") xsDataResultReference = XSDataResultSaxsCurvesv1_0.parseString(strExpectedOutput) xsDataResultObtained = plugin.getDataOutput() EDAssert.strAlmostEqual(xsDataResultReference.marshal(), xsDataResultObtained.marshal(), "XSDataResult output are the same") outputData = open(xsDataResultObtained.getOutputDataFile().getPath().getValue(), "rb").read() referenceData = open(os.path.join(self.getTestsDataImagesHome(), "bsa_013_08.dat"), "rb").read() EDVerbose.DEBUG("Expected= %s" % os.path.join(self.getTestsDataImagesHome(), "bsa_013_08.dat")) EDVerbose.DEBUG("Obtained= %s" % xsDataResultObtained.getOutputDataFile().getPath().getValue()) EDAssert.strAlmostEqual(outputData, referenceData, _strComment="Curves are the same", _strExcluded="bsa_013_08")
def testExecute(self): """ """ self.run() plugin = self.getPlugin() strExpectedOutput = self.readAndParseFile( self.getReferenceDataOutputFile()) # strObtainedOutput = self.readAndParseFile (self.m_edObtainedOutputDataFile) EDVerbose.DEBUG("Checking obtained result...") xsDataResultReference = XSDataResultSaxsCurvesv1_0.parseString( strExpectedOutput) xsDataResultObtained = plugin.getDataOutput() EDAssert.strAlmostEqual(xsDataResultReference.marshal(), xsDataResultObtained.marshal(), "XSDataResult output are the same") outputData = os.linesep.join([ i.strip() for i in open( xsDataResultObtained.getOutputDataFile().getPath().getValue(), "rb") if not i.startswith("#") ]) referenceData = os.linesep.join([ i.strip() for i in open( os.path.join(self.getTestsDataImagesHome(), "bsa_013_08.dat"), "rb") if not i.startswith("#") ]) # EDVerbose.DEBUG("Expected= %s" % os.path.join(self.getTestsDataImagesHome(), "bsa_013_08.dat")) # EDVerbose.DEBUG("Obtained= %s" % xsDataResultObtained.getOutputDataFile().getPath().getValue()) EDAssert.strAlmostEqual( outputData, referenceData, _strComment="Curves are the same", )