def run(): for test in tests: infile = test["name"] + ".t2t" outfile = test["name"] + "." + (test.get("target") or "out") extra = test.get("extra") or [] cmdline = test["cmdline"] if "noinfile" not in extra: cmdline = test["cmdline"] + [infile] if lib.initTest(test["name"], infile, outfile): # create the extra files (if needed for this test) if "config" in extra: lib.WriteFile(lib.CONFIG_FILE, CONFIG_FILE_TXT) if "css" in extra: lib.WriteFile(lib.CSS_FILE, CSS_FILE_TXT) # may I add the -t target automatically? if "notarget" not in extra: cmdline = ["-t", test["target"]] + cmdline # may I redirect the output to a file? if test.get("redir"): cmdline.extend(test["redir"]) # always catch the error output cmdline.append("2>&1") # create the source file lib.WriteFile(infile, test["content"]) # convert and check results lib.test(cmdline, outfile) # remove the trash os.remove(infile) if os.path.isfile(lib.CSS_FILE): os.remove(lib.CSS_FILE) if os.path.isfile(lib.CONFIG_FILE): os.remove(lib.CONFIG_FILE)
def addFilters(filters): config = [] cmdline = [] for filter_ in filters: config.append("%%!%sproc: '%s' %s" % filter_) if config: lib.WriteFile(lib.CONFIG_FILE, '\n'.join(config)) cmdline = ['-C', lib.CONFIG_FILE] return cmdline
def run(): for test in tests: target = test.get('target') or 'txt' infile = test['name'] + '.t2t' outfile = test.get('outfile') or test['name'] + '.' + target extra = test.get('extra') or [] cmdline = ['-i', infile] + test.get('cmdline', []) content = test['content'] if 'noversion' in extra: content = VERSION_GOTCHA + content if 'error' in extra: outfile = test['name'] + '.out' if lib.initTest(test['name'], infile, outfile): # create the extra files (if needed for this test) if 'config' in extra: lib.WriteFile(lib.CONFIG_FILE, CONFIG_FILE_TXT) if 'css' in extra: lib.WriteFile(lib.CSS_FILE, CSS_FILE_TXT) # may I add the -t target automatically? if not 'notarget' in extra: cmdline = ['-t', target] + cmdline # may I redirect the output to a file? if test.get('redir'): cmdline.extend(test['redir']) elif 'error' in extra: cmdline.append('> %s.out' % test['name']) # always catch the error output cmdline.append('2>&1') # create the source file lib.WriteFile(infile, EMPTY_HEADER + content + '\n' + SIMPLE_BODY) # convert and check results lib.convert(cmdline) lib.diff(outfile) lib.convert(cmdline, True) lib.diff(outfile) # remove the trash os.remove(infile) if os.path.isfile(lib.CSS_FILE): os.remove(lib.CSS_FILE) if os.path.isfile(lib.CONFIG_FILE): os.remove(lib.CONFIG_FILE) return lib.OK, lib.FAILED, lib.ERROR_FILES
def addFilters(filters): if not filters: return [] config = [] cmdline = [] for filter in filters: config.append("%%!%sproc: '%s' '%s'" % filter) if config: lib.WriteFile(lib.CONFIG_FILE, "\n".join(config)) cmdline = ["-C", lib.CONFIG_FILE] return cmdline
def addFilters(filters): if not filters: return [] config = [] cmdline = [] for filter in filters: config.append("%%!%sproc: '%s' %s" % filter) # don't quote 2nd -- breaks tagged filter if config: lib.WriteFile(lib.CONFIG_FILE, '\n'.join(config)) cmdline = ['-C', lib.CONFIG_FILE] return cmdline
def run(): for test in tests: infile = test['name'] + '.t2t' outfile = test['name'] + '.' + (test.get('target') or 'out') extra = test.get('extra') or [] cmdline = test['cmdline'] if not 'noinfile' in extra: cmdline = test['cmdline'] + [infile] if lib.initTest(test['name'], infile, outfile): # create the extra files (if needed for this test) if 'config' in extra: lib.WriteFile(lib.CONFIG_FILE, CONFIG_FILE_TXT) if 'css' in extra: lib.WriteFile(lib.CSS_FILE, CSS_FILE_TXT) # may I add the -t target automatically? if not 'notarget' in extra: cmdline = ['-t', test['target']] + cmdline # may I remove the SVN revision number? if 'norevision' in extra: cmdline.append(' | sed "%s;%s"' % (SED_NO_REVISION1, SED_NO_REVISION2)) # may I redirect the output to a file? if test.get('redir'): cmdline.extend(test['redir']) # always catch the error output cmdline.append('2>&1') # create the source file lib.WriteFile(infile, test['content']) # convert and check results lib.convert(cmdline) lib.diff(outfile) lib.convert(cmdline, True) lib.diff(outfile) # remove the trash os.remove(infile) if os.path.isfile(lib.CSS_FILE): os.remove(lib.CSS_FILE) if os.path.isfile(lib.CONFIG_FILE): os.remove(lib.CONFIG_FILE) return lib.OK, lib.FAILED, lib.ERROR_FILES
def run(): for testid in tests.split(): infile = testid + ".t2t" outfile = testid + ".html" cmdline = ["-t html -C test.conf", infile] if lib.initTest(testid, infile, outfile): # compose source file contents infile_txt = [] for letter in testid: infile_txt.append(txt[letter]) infile_txt = "\n".join(infile_txt) # create the source file lib.WriteFile(infile, infile_txt) # convert and check results lib.test(cmdline, outfile) # remove the trash os.remove(infile)
def run(): for testid in tests.split(): infile = testid + '.t2t' outfile = testid + '.html' cmdline = ['-t html --css-sugar -C test.conf', infile] if lib.initTest(testid, infile, outfile): # compose source file contents infile_txt = [] for letter in testid: infile_txt.append(txt[letter]) infile_txt = '\n'.join(infile_txt) # create the source file lib.WriteFile(infile, infile_txt) # convert and check results lib.test(cmdline, outfile) # remove the trash os.remove(infile) return lib.OK, lib.FAILED, lib.ERROR_FILES