Mercurial > python-cmd2
diff example/example.py @ 254:07dff0ba981e
multiple test files
author | Catherine Devlin <catherine.devlin@gmail.com> |
---|---|
date | Wed, 01 Apr 2009 18:05:51 -0400 |
parents | 7d215852f9a6 |
children | d62bb3dd58a0 |
line wrap: on
line diff
--- a/example/example.py Tue Mar 31 17:47:04 2009 -0400 +++ b/example/example.py Wed Apr 01 18:05:51 2009 -0400 @@ -32,14 +32,18 @@ class TestMyAppCase(Cmd2TestCase): CmdApp = CmdLineApp - transcriptFileName = 'exampleSession.txt' + transcriptExtension = 'test' parser = optparse.OptionParser() -parser.add_option('-t', '--test', dest='unittests', action='store_true', default=False, help='Run unit test suite') +parser.add_option('-a', '--alltests', dest='test', action="store_true", + help='Run all transcript tests') +parser.add_option('-t', '--testfile', dest='testfile', metavar='FILE', + help='Run a single transcript from file FILE') (callopts, callargs) = parser.parse_args() -if callopts.unittests: +if callopts.testfile or callopts.test: + CmdLineApp.testfile = callopts.testfile sys.argv = [sys.argv[0]] # the --test argument upsets unittest.main() unittest.main() else: app = CmdLineApp() - app.cmdloop() + app.cmdloop() \ No newline at end of file