[TIP] Unittesting command line scripts with unittest2?

Jorge Vargas jorge.vargas at gmail.com
Wed Jul 28 21:09:24 PDT 2010

On Wed, Jul 28, 2010 at 6:31 PM, holger krekel <holger at merlinux.eu> wrote:
> On Wed, Jul 28, 2010 at 18:10 -0400, Jorge Vargas wrote:
> What i usually do is define a main(args=None) function and set
> args to sys.argv[1:] in case it is None.  This way you can
> call "main(['status'])" from your tests and don't need to
> worry about global sys.argv settings during the test.

Right, I think I'm going to do that.

Right now I'm having troubles with the stdout replacement, as it's
swallowing up the coverage report :)

Seems like tearDown is called after the coverage report, because I get
the dots and the ok/failure message.

More information about the testing-in-python mailing list