Showing posts with label cmd2. Show all posts
Showing posts with label cmd2. Show all posts

Wednesday, March 03, 2010

cmd2 0.6.1

Many thanks to the audience at my PyCon cmd/cmd2 talk for your interest and enthusiasm! It was my first full-scale PyCon presentation and I absolutely loved it.

I need to follow up on three things I claimed in my talk:

1. "My presentation is already online at http://pypi.python.org/pypi/cmd2". FALSE (at the time I said it, and for several days afterward). I actually had posted the docs and edited the PyPI page to point to them, but forgot to update url in setup.py, so it overwrote the link when I registered cmd2's 0.6.0 release.

It's fixed now, though. The cmd2 PyPI page has a link to the cmd2 documentation, which in turn links to my talk slides. You can also watch the talk thanks to the fantastic PyCon video crew!

2. "A more stable version will be out within a couple weeks of PyCon." TRUE. 0.6.1 is not exactly stable stable, but I think I've smoothed out bugs that snuck in while I was pushing to release 0.6.0 for PyCon.

3. "sqlpython will be more presentable in a couple weeks, too." TRUE. The new sqlpython 1.7.1 brings the postgreSQL functionality (thanks Andy!) to pretty near 100% (except for the can't-see-other's-schemas problem, which should be fixed for 1.7.2.) I believe that MySQL should be fully functional, too, but that's very lightly tested because I barely use MySQL and don't know much about how to test it.

Wednesday, October 29, 2008

cmd2 0.4, now with testing

cmd2 0.4 has been released. Its biggest new feature is transcript-based testing. Basically, you can write a test suite for your cmd2-based application just this easily:

1. Add to your application script (suppose it's myCmd2App.py):

from cmd2 import Cmd2TestCase
class TestMyAppCase(Cmd2TestCase):
CmdApp = CmdLineApp
transcriptFileName = 'exampleSession.txt'

parser = optparse.OptionParser()
parser.add_option('-t', '--test', dest='unittests', action='store_true', default=False, help='Run unit test suite')
(callopts, callargs) = parser.parse_args()
if callopts.unittests:
sys.argv = [sys.argv[0]] # the --test argument upsets unittest.main()
unittest.main()
else:
app = CmdLineApp()
app.cmdloop()
2. Run a session of your application. Run all the commands you want to test.

3. Cut-and-paste your entire session into exampleSession.txt.

4. Run python myCmd2App.py -t

Ta-da! cmd2 runs runs your app, issues all the commands saved in exampleSession.txt, and verifies that they produce the same output as in your transcript. Now you can change your app fearlessly without bugs sneaking in.

Finally, cmd2 is now available for Python 2.4 through 2.6.