comparison example/example.py @ 258:7a98d7f2da30

I get it - BASH line expansion of file names gets me
author Catherine Devlin <catherine.devlin@gmail.com>
date Thu, 02 Apr 2009 17:22:02 -0400
parents d62bb3dd58a0
children 5147fa4166b0
comparison
equal deleted inserted replaced
257:d62bb3dd58a0 258:7a98d7f2da30
30 do_say = do_speak # now "say" is a synonym for "speak" 30 do_say = do_speak # now "say" is a synonym for "speak"
31 do_orate = do_speak # another synonym, but this one takes multi-line input 31 do_orate = do_speak # another synonym, but this one takes multi-line input
32 32
33 class TestMyAppCase(Cmd2TestCase): 33 class TestMyAppCase(Cmd2TestCase):
34 CmdApp = CmdLineApp 34 CmdApp = CmdLineApp
35 35 import logging
36 logging.basicConfig(level=logging.DEBUG,
37 filename='exlog.txt',
38 filemode='w')
36 parser = optparse.OptionParser() 39 parser = optparse.OptionParser()
37 parser.add_option('-t', '--test', dest='test', metavar='FILE', 40 parser.add_option('-t', '--test', dest='test', metavar='FILE',
38 help='''Test against transcript(s) in FILE (wildcards OK)''') 41 help='''Test against transcript(s) in FILE (wildcards OK)''')
39 (callopts, callargs) = parser.parse_args() 42 (callopts, callargs) = parser.parse_args()
43 logging.error(callopts)
40 if callopts.test: 44 if callopts.test:
41 CmdLineApp.testfile = callopts.test 45 CmdLineApp.testfile = callopts.test
46 logging.error(CmdLineApp.testfile)
42 sys.argv = [sys.argv[0]] # the --test argument upsets unittest.main() 47 sys.argv = [sys.argv[0]] # the --test argument upsets unittest.main()
43 unittest.main() 48 unittest.main()
44 else: 49 else:
45 CmdLineApp().cmdloop() 50 CmdLineApp().cmdloop()