[mod_python] Unit testing in mod_python

Graham Dumpleton grahamd at dscpl.com.au
Mon Jan 9 16:53:10 EST 2006


Sebastjan Trepca wrote ..
> Hi,
> 
> does anyone know of any mod_python unittest module which could generate
> a
> "fake request" so you could effectivly test your handlers?
> 
> For example:
> import my_handler
> 
> fake_request = get_basic_request(qs="test1=1&test2=2")
> assert my_handler.handle(fake_request)==apache.OK
> assert fake_request.out.startswith('<html>')

It isn't going to be quite what you want, as it still requires Apache for the
tests, but have a look at the 'test' directory in mod_python for a way of
setting up automated testing for code running under Apache.

To set up a test framework that can adequately emulate the mod_python
environment outside of Apache would probably be technically possible,
just a bit of work to write.

Graham


More information about the Mod_python mailing list