Skip to content

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


  1. Ivo wrote:

    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.

    Friday, April 27, 2012 at 9:22 pm | Permalink
  2. admin wrote:

    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.

    Wednesday, May 2, 2012 at 9:40 pm | Permalink

Post a Comment

Your email is never published nor shared. Required fields are marked *