Example #1
0
    def run(self,
            gt_set,
            images,
            masks,
            backbone_net,
            task,
            in_pr_dir,
            cache_im_dir,
            output_dir,
            kwargs=None):

        assert task in self.cfg.MAIN_DEFAULT_TASKS, \
            '[ERROR] unknown task name provided: {}'.format(self.task)

        if task == 'CFM':
            data_gen = CFMGenerator(images=images,
                                    masks=masks,
                                    bbox_means=None,
                                    bbox_stds=None,
                                    num_cls=self.dataset.num_cls,
                                    cfm_t=None,
                                    in_gt_dir=None,
                                    in_pr_dir=in_pr_dir,
                                    cache_im_dir=cache_im_dir,
                                    cfg=self.cfg)
        elif self.task == 'MNC':
            raise NotImplemented

        elif self.task == 'FCIS':
            raise NotImplemented

        elif self.task == 'MRCNN':
            raise NotImplemented

        tw = TestWrapper(self.model['proto'], self.model['weights'], task,
                         data_gen, output_dir, self.cfg)

        print 'Testing...'
        tw.test_model(gt_set, backbone_net, self.dataset, True, kwargs)
        print 'done testing'
Example #2
0
def main(args):
    prevDir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
    currentDir = args.directory
    testFile = args.testFile

    if currentDir == None:
        currentDir = prevDir
    if testFile == None:
        testFile = os.path.join(currentDir, "Test.py")

    downloadsFolder, reportsFolder = setupFilesAndFolders(prevDir, currentDir)

    gmail = GmailCommunication(args)

    if args.alreadyExistingModules:
        modules = []
        for f in os.listdir(currentDir):
            pathToFile = os.path.join(currentDir,f)
            head, extension = os.path.splitext(pathToFile)
            if os.path.isfile(pathToFile) and extension == ".py" \
            and f != "conftest.py" and not f.lower().startswith("test"):
                modules.append(pathToFile)
        print modules
        for module in modules:
            moduleName = os.path.splitext(os.path.split(module)[1])[0]
            reportFile = os.path.join(reportsFolder, moduleName + ".html")
            print testFile, module, reportFile
            t = TestWrapper(testFile, module, reportFile)
            t.runTests()

    oldMessages = []
    while True:
        print "Recibiendo mensajes"
        messages = gmail.getMessages()
        for m in messages:
            if m['id'] not in oldMessages:
                message = gmail.getMessage(m['id'])
                msgFromMail = gmail.getHeaderFrom(message)
                msgFromName = gmail.getStudentByMail(msgFromMail)
                msgAttachment = gmail.getAttachments(message, downloadsFolder, msgFromName)
                reportFile = os.path.join(reportsFolder, msgFromName + ".html")
                if msgAttachment != "":
                    t = TestWrapper(testFile, msgAttachment, reportFile)
                    t.runTests()
                    gmail.createAndSendMessage(msgFromMail, reportsFolder, msgFromName + ".html")

                oldMessages.append(m['id'])

        time.sleep(60)
Example #3
0
import os,sys,inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0,parentdir) 
from TestWrapper import TestWrapper
# for i in range(3):
#     params = "testPy.py --timeout=10 --libname=m" + str(i+1)
#     pytest.main(params)

testPath = "/home/juanjo/Proyectos/PythonAuxiliar/Examples/testPy.py"
modulePathTemplate = "/home/juanjo/Proyectos/PythonAuxiliar/Examples/m"
reportPathTemplate = "/home/juanjo/Proyectos/PythonAuxiliar/Examples/Reports/m"
for i in range(1,4):
    t = TestWrapper(testPath, modulePathTemplate + str(i) + ".py", reportPathTemplate + str(i) + ".html")
    t.runTests()
# moduleName = "/home/juanjo/Proyectos/Auxiliar/m1.py"
# reportFile = "/home/juanjo/Proyectos/Auxiliar/Reports/yo.html"
# t = TestWrapper(testPath, moduleName, reportFile)
# t.runTests()