コード例 #1
0
def writeTestSteps(aIni, aPath):
    cfg = ConfigParser.ConfigParser()
    cfg.readfp(file(aIni))

    for s in cfg.sections():
        typ = cfg.get(s, 'Type').lower()

        if typ == 'command':
            folded = getFolded(getEntries(cfg.get(s, 'Datafile')),
                               getTypes(cfg.get(s, 'Typefile')), 3)
            writeCommandTestSteps(
                folded,
                string.Template(
                    file(cfg.get(s, 'TestStepHeaderTemplate')).read()),
                string.Template(
                    file(cfg.get(s, 'TestStepSourceTemplate')).read()), aPath)
        elif typ == 'event':
            writeEventTestSteps(
                getFolded(getEntries(cfg.get(s, 'Datafile')),
                          getTypes(cfg.get(s, 'Typefile')), 0),
                string.Template(
                    file(cfg.get(s, 'TestStepHeaderTemplate')).read()),
                string.Template(
                    file(cfg.get(s, 'TestStepSourceTemplate')).read()), aPath)
        elif typ == 'completeevent':
            writeCompleteEventTestSteps(
                getFolded(getEntries(cfg.get(s, 'Datafile')),
                          getTypes(cfg.get(s, 'Typefile')), 0),
                string.Template(
                    file(cfg.get(s, 'TestStepHeaderTemplate')).read()),
                string.Template(
                    file(cfg.get(s, 'TestStepSourceTemplate')).read()), aPath)
コード例 #2
0
def makeTestSteps(aCfg, aSections):
    if aSections == []:
        return []
    else:
        return makeTestStep(aCfg.get(aSections[0], 'Type'),
                            getFolded(getEntries(aCfg.get(aSections[0], 'Datafile')), getTypes(aCfg.get(aSections[0], 'Typefile')), 0)) + makeTestSteps(aCfg, aSections[1:])
コード例 #3
0
        for s in cfg.sections():
            entries = getEntries(cfg.get(s, 'Datafile'))
            types = getTypes(cfg.get(s, 'Typefile'))
            headerTemplate = string.Template(file(cfg.get(s, 'HeaderTemplate')).read())
            sourceTemplate = string.Template(file(cfg.get(s, 'SourceTemplate')).read())

            typ = cfg.get(s, 'Type').lower()

            if os.path.exists(cfg.get(s, 'SourcePath')) == False:
                os.mkdir(cfg.get(s, 'SourcePath'))

            if os.path.exists(cfg.get(s, 'HeaderPath')) == False:
                os.mkdir(cfg.get(s, 'HeaderPath'))

            if typ == 'command':
                folded = getFolded(entries, types, 3)
                print('Writing %i commands\n\theaders at %s\n\tsource at %s...'
                      % (len(folded), cfg.get(s, 'HeaderPath'), cfg.get(s, 'SourcePath')))

                for f in folded:
                    writeCommand(f, folded[f][0], folded[f][1], headerTemplate, sourceTemplate,
                                 cfg.get(s, 'HeaderPath'), cfg.get(s, 'SourcePath'))
            elif typ == 'event':
                folded = getFolded(entries, types, 2)
                print('Writing %i events\n\theaders at %s\n\tsource at %s...'
                      % (len(folded), cfg.get(s, 'HeaderPath'), cfg.get(s, 'SourcePath')))

                for f in folded:
                    writeEvent(f, folded[f][1], headerTemplate, sourceTemplate,
                               cfg.get(s, 'HeaderPath'), cfg.get(s, 'SourcePath'))
            elif typ == 'completeevent':