Mercurial > python-cmd2
comparison example/example.py @ 326:237a89d5a4a9
run() working
author | catherine@dellzilla |
---|---|
date | Thu, 11 Feb 2010 17:47:29 -0500 |
parents | 4172feeddf76 |
children | e9eea93c777c |
comparison
equal
deleted
inserted
replaced
325:4172feeddf76 | 326:237a89d5a4a9 |
---|---|
29 | 29 |
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 c = CmdLineApp() | 33 c = CmdLineApp() |
34 #run(c) | 34 run(c) |
35 | 35 |
36 ''' | |
36 class TestMyAppCase(Cmd2TestCase): | 37 class TestMyAppCase(Cmd2TestCase): |
37 CmdApp = CmdLineApp | 38 CmdApp = CmdLineApp |
38 parser = optparse.OptionParser() | 39 parser = optparse.OptionParser() |
39 parser.add_option('-t', '--test', dest='test', action="store_true", | 40 parser.add_option('-t', '--test', dest='test', action="store_true", |
40 help='Test against transcript(s) in FILE (wildcards OK)') | 41 help='Test against transcript(s) in FILE (wildcards OK)') |
42 if callopts.test: | 43 if callopts.test: |
43 CmdLineApp.testfiles = callargs | 44 CmdLineApp.testfiles = callargs |
44 sys.argv = [sys.argv[0]] # the --test argument upsets unittest.main() | 45 sys.argv = [sys.argv[0]] # the --test argument upsets unittest.main() |
45 unittest.main() | 46 unittest.main() |
46 else: | 47 else: |
47 CmdLineApp().cmdloop() | 48 CmdLineApp().cmdloop()''' |