Unit testing Cmd module derived classes

I’ll update this once I’ve figured it out.

I’m writing a customised command-line task manager in Python using the Cmd¬†module. I’ve decided, for practice, to use nice test-driven development so I’ve kicked it off with a very simple Cmd-derived class and a corresponding test class. I’ve added a few very simple methods kicked off by the¬†cmdloop() method but of course in my test class I’d like to create an instance of my cmd-derived class , invoke the cmdloop() and send it some input.

How do I send my object some input from my test method?

Google+ Comments

2 thoughts on “Unit testing Cmd module derived classes

  1. Hi, did you manage to resolve this? My idea is the same. I’d like to program tool I need for my work using TDD method.

  2. hi Ivo,

    Afraid I haven’t – and i’v eput it on the back burner for a bit while I work on a few other things. Sorry.

Leave a Reply

Your email address will not be published. Required fields are marked *