예제 #1
0
class RunServerTest:
    """
    Test the server output with different images located in the given folder
    """

    def __init__(self):
        self.fileList = []
        self.serverObj = ServerTest()

    def runTest(self, path):
        try:
            absPath = None
            for fileName in os.listdir(path):
                absPath = os.path.join(path + fileName)
                if os.path.isfile(absPath) and re.match(".*\.jpg", fileName):
                    self.fileList.append(absPath)
                    self.serverObj.sendFile(absPath)
                elif os.path.isdir(absPath) and not re.match("\..*", fileName):
                    self.runTest(absPath + "/")
        except Exception as e:
            #             print '\tRunError:'+ str(e) + '; while processing' + str(absPath or path)
            module_logger.exception("\n\tRunError:" + str(e) + "; while processing" + str(absPath or path))

    def out(self):
        self.serverObj.out()
        #         print '\tTotal number of files: ' + str(len(self.fileList))
        module_logger.info("\tTotal number of files: " + str(len(self.fileList)))
예제 #2
0
 def __init__(self):
     self.fileList = []
     self.serverObj = ServerTest()