5
from optparse import OptionParser
6
from pyfiglet import Figlet
7
from subprocess import Popen, STDOUT, PIPE
12
for line in text.split('\n'):
16
parser = OptionParser(version=__version__)
18
parser.add_option('-s', '--show', action='store_true', default=False,
19
help='pause at each failure and compare output '
20
'(default: %default)')
22
opts, args = parser.parse_args()
29
skip = ['runic'] # known bug..
31
for font in f.getFonts():
32
if font in skip: continue
36
outputPyfiglet = f.renderText('foo')
38
fontpath = os.path.join('pyfiglet', 'fonts', font)
39
if os.path.isfile(fontpath + '.flf'):
40
cmd = ('figlet', '-d', 'pyfiglet/fonts', '-f', font, 'foo')
41
elif os.path.isfile(fontpath + '.tlf'):
42
cmd = ('toilet', '-d', 'pyfiglet/fonts', '-f', font, 'foo')
44
raise Exception('Missing font file')
46
p = Popen(cmd, bufsize=1,stdout=PIPE)
47
outputFiglet = p.communicate()[0]
49
if outputPyfiglet == outputFiglet:
50
print '[OK] %s' % font
54
print '[FAIL] %s' % font
59
print '[PYTHON] *** %s\n\n' % font
61
print '[FIGLET] *** %s\n\n' % font
65
print 'OK = %d, FAIL = %d' % (ok, fail)
67
print 'FAILED = %s' % repr(failed)
71
if __name__ == '__main__': sys.exit(main())