[TIP] Unittesting command line scripts with unittest2?

Jorge Vargas jorge.vargas at gmail.com
Thu Jul 29 06:59:42 PDT 2010


On Thu, Jul 29, 2010 at 8:42 AM, Michael Foord
<fuzzyman at voidspace.org.uk> wrote:
> On 29/07/2010 05:35, Jorge Vargas wrote:
>>
>> I believe the following code should do it right.
>>
>> http://paste.ofcode.org/bVdw7bcu74VhaAtaAk33KM
>>
>> it
>> a- stores a copy of stdout/stderr, so you can assert against it after
>> calling made and it echos back to the terminal
>> b- it restores the original values just in case something else needs them.
>>
>> And I haven't added Holger's suggesting of doing main(args=None) which
>> I think it's a good idea.
>>
>
> It looks okay. You probably mean tearDown rather than teadDown.

ahhh thanks! nice catch :)



More information about the testing-in-python mailing list