/test/gotchas/run.py
http://txt2tags.googlecode.com/ · Python · 38 lines · 25 code · 6 blank · 7 comment · 4 complexity · 18e775deff858059f8f6966526928cd8 MD5 · raw file
- #
- # txt2tags marks gotchas tester (http://txt2tags.org)
- # See also: ../run.py ../lib.py
- #
- import os, sys, re, glob
- sys.path.insert(0, '..')
- import lib
- del sys.path[0]
- # sux
- lib.OK = lib.FAILED = 0
- lib.ERROR_FILES = []
- def run():
- # test all OK files found
- for outfile in glob.glob("ok/*"):
- basename = re.sub('\..*?$', '', outfile.replace('ok/', ''))
- target = re.sub('.*\.', '', outfile)
- infile = basename + ".t2t"
- outfile = outfile.replace('ok/', '')
- if lib.initTest(basename, infile, outfile):
- cmdline = ['-H']
- cmdline.extend(['-t', target])
- cmdline.append(infile)
- lib.convert(cmdline)
- lib.diff(outfile)
- lib.convert(cmdline, True)
- lib.diff(outfile)
- # clean up
- if os.path.isfile(lib.CONFIG_FILE):
- os.remove(lib.CONFIG_FILE)
-
- return lib.OK, lib.FAILED, lib.ERROR_FILES
- if __name__ == '__main__':
- print lib.MSG_RUN_ALONE