예제 #1
0
 def RemoveTest(self, key):
     deletedSettings = self.__testList[key].GetSettings()
     
     for regExId in self.GetRegExIdGenerator():
         if (deletedSettings == self.GetRegExSettings(regExId)):
             ignoredRegEx = self.GetIgnoredRegExList(regExId)
             if (len(ignoredRegEx) == 0):
                 ignoredRegEx.append("")
             
             displayedFilename = FUtils.GetRelativePath(
                     self.__testList[key].GetDataSetPath(), MAIN_FOLDER)
             regExPath = FUtils.NormalizeRegEx(displayedFilename)
             newIgnored = ignoredRegEx[-1]
             if (newIgnored != ""):
                 newIgnored = newIgnored + "|"
             newIgnored = newIgnored + regExPath
             if (len(newIgnored) < 30000):
                 ignoredRegEx[-1] = newIgnored
             else:
                 ignoredRegEx.append(regExPath)
             self.SetIgnoredRegEx(regExId, ignoredRegEx)
     
     try:
         testDir = os.path.join(self.__procedureDir, TEST_PREFIX + str(key))
         shutil.rmtree(testDir)
     except Exception, e:
         pass
예제 #2
0
    def __GetDataSets(self, concatRegEx=[]):
        if (self.__mode == FSelectDataSetDialog.__TREE):
            paths = []
            rootItem = self.__treeCtrl.GetRootItem()
            if (rootItem.IsOk()):
                for childItem, childDataSetDir in self.__visibleRoot:
                    dir = os.path.dirname(os.path.abspath(childDataSetDir))
                    dir = FUtils.GetRelativePath(dir, os.getcwd())
                    self.__GetCheckedRecursive(paths, childItem, dir, False)

            regEx = []
            if (len(paths) != 0):
                regEx.append("")
                if (concatRegEx == []):
                    concatRegEx.append("")
                curIndex = 0
                concatCurIndex = len(concatRegEx) - 1
                for path in paths:
                    relPath = FUtils.NormalizeRegEx(
                        FUtils.GetRelativePath(path, MAIN_FOLDER))
                    newRegEx = regEx[curIndex] + relPath + "|"
                    concatNewRegEx = (concatRegEx[concatCurIndex] + relPath +
                                      "|")

                    if (len(newRegEx) < 30000):
                        regEx[curIndex] = newRegEx
                    else:
                        regEx[curIndex] = regEx[curIndex][:-1]
                        regEx.append(relPath + "|")
                        curIndex = curIndex + 1
                    if (len(concatNewRegEx) < 30000):
                        concatRegEx[concatCurIndex] = concatNewRegEx
                    else:
                        concatRegEx[concatCurIndex] = concatRegEx[
                            concatCurIndex][:-1]
                        concatRegEx.append(relPath + "|")
                        concatCurIndex = concatCurIndex + 1
                regEx[curIndex] = regEx[curIndex][:-1]
                concatRegEx[concatCurIndex] = concatRegEx[concatCurIndex][:-1]
        else:
            regEx = self.__GetRegEx()
            paths, items = self.__GetPathsAndItems(regEx)
            if (regEx == ""):
                regEx = []
            else:
                if (len(concatRegEx) == 0):
                    concatRegEx.append("")

                concatNewRegEx = concatRegEx[-1] + regEx
                if (len(concatNewRegEx) < 30000):
                    concatRegEx[-1] = concatNewRegEx
                else:
                    # the text control only allows up to 30k characters
                    concatRegEx.append(regEx)
                regEx = [regEx]

        return (paths, regEx)
예제 #3
0
    def OpenTestProcedure(self, filename):
        testProcedure = self.__BusyInfoOpenTestProcedure(filename)
        recovered = testProcedure.GetRecoveredTestIds()
        if (recovered != ""):
            FUtils.ShowWarning(
                self, "Encountered unfinished test " +
                "executions. Recovering to previous finished execution " +
                "for these tests:\n\n" + recovered)

        for regExId in testProcedure.GetRegExIdGenerator():
            dataSets = self.__BusyInfoCheckForNewTests(testProcedure, regExId)
            if (len(dataSets) == 0): continue

            displayDataSets = ""
            for dataSet in dataSets:
                displayDataSets = (
                    displayDataSets +
                    FUtils.GetRelativePath(dataSet, MAIN_FOLDER) + "\n")

            if (FUtils.ShowConfirmation(
                    self, "Found these missing data sets for " +
                    "Regular Expression " + str(regExId) + ": \n" +
                    testProcedure.GetRegExString(regExId) + "\n\n\n" +
                    displayDataSets + "\n\n" +
                    "Do you want to add them to the test procedure? " +
                    "Selecting \"No\" will also ignore them from future " +
                    "confirmations.", False)):
                settings = testProcedure.GetRegExSettings(regExId)
                for dataSet in dataSets:
                    testProcedure.AddTest(dataSet, settings)
            else:
                ignored = testProcedure.GetIgnoredRegExList(regExId)
                if (len(ignored) == 0):
                    ignored.append("")  # len(dataSet) != 0
                for dataSet in dataSets:
                    displayedFilename = FUtils.GetRelativePath(
                        dataSet, MAIN_FOLDER)
                    regExPath = FUtils.NormalizeRegEx(displayedFilename)
                    newIgnored = ignored[-1]
                    if (newIgnored != ""):
                        newIgnored = newIgnored + "|"
                    newIgnored = newIgnored + regExPath
                    if (len(newIgnored) < 30000):
                        ignored[-1] = newIgnored
                    else:
                        ignored.append(regExPath)
                testProcedure.SetRegEx(regExId,
                                       testProcedure.GetRegExList(regExId),
                                       ignored)

        busyInfo = wx.BusyInfo("Opening test procedure: Creating grid. " +
                               "Please wait...")

        child = RunTable(self.__MDIparent, wx.ID_ANY, testProcedure)
        child.Maximize(True)
        child.Show(True)
예제 #4
0
    def __GetPathsAndItems(self, regEx):
        dir = FUtils.NormalizeRegEx(os.path.normpath(MAIN_FOLDER))
        pattern = re.compile(dir + "[/\\\\]" + regEx + "$")

        paths = []
        items = []
        for path, item in self.__allPaths:
            match = pattern.match(path)
            if (match != None):
                if (match.group() == path):
                    paths.append(os.path.dirname(path))
                    items.append(item)
        return (paths, items)
예제 #5
0
 def CheckForNewTests(self, regExId):
     newDataSets = []
     dir = FUtils.NormalizeRegEx(os.path.normpath(MAIN_FOLDER))
     
     ignoredPatterns = []
     for i in self.GetIgnoredRegExPageGenerator(regExId):
         ignoredPatterns.append(re.compile("(" + dir + ")(/|\\\\)(" + 
                 self.GetIgnoredRegEx(regExId, i) + ")$"))
     
     for regExPage in self.GetRegExPageGenerator(regExId):
         pattern = re.compile("(" + dir + ")(/|\\\\)(" + 
                 self.GetRegEx(regExId, regExPage) + ")$")
         tempDataSets = []
         for dataSetDir in DATA_SET_DIRS:
             self.__CheckForNewTestsRecurse(dataSetDir, pattern, 
                     self.GetRegExSettings(regExId), tempDataSets, 
                     ignoredPatterns)
         newDataSets = newDataSets + tempDataSets
     
     return newDataSets