[TIP] testing for sysadmins who know bash advice

Graham Carlyle graham.carlyle at maplecroft.net
Mon Jan 14 08:46:34 PST 2008


On Tue, 2008-01-08 at 11:29 -0800, Grig Gheorghiu wrote:
> I don't think I'd use doctest though. A lot of sysadmin scripts touch
> the file system, so doctest will have problems because you can't expect
> a certain precise output. I'd use either nose or py.test.

I don't see why doctest will have problems any more than a "xUnit" style
test. You still need to create a reproducible context or fixture for the
tests, which you can do in doctest. I find the Layer feature in the
zope.testing test runner useful for this.
http://pypi.python.org/pypi/zope.testing/3.5.1#layers

I find doctest easier to read and write than the xUnit style, and would
think quite suitable for illustrating how to test sysadmin scripts.

Graham





More information about the testing-in-python mailing list