[TIP] Functional Test Runner for Command Line Tools?

Gary Bernhardt gary.bernhardt at gmail.com
Mon Apr 13 21:33:22 PDT 2009


On Tue, Apr 14, 2009 at 12:15 AM, Noah Gift <noah.gift at gmail.com> wrote:
> In looking at http://pycheesecake.org/wiki/PythonTestingToolsTaxonomy
> I don't see something that automates writing functional tests for
> command line tools.  Hopefully, I am wrong, but I am looking for
> something that will fully exercise a command line tool easily.  How is
> everyone else testing their command line tools?

I've had good success just shelling out with subprocess:

output = Popen(command, stderr=STDOUT, stdout=PIPE, shell=True).read()

My projects tend to have a bit of glue for doing that (maybe 20-30
lines). From there they just make assertions about the full or partial
output. I haven't felt enough pain to look for (or write) libraries
that help out with this stuff. But maybe there is goodness that I
don't know I'm missing. :)

-- 
Gary
http://blog.extracheese.org



More information about the testing-in-python mailing list