[mod_python] Unit Testing mod_python apps.

Martijn Moeling martijn at xs4us.nu
Fri Jun 20 05:06:05 EDT 2008


Kurt,
 
I personally make python modules wich can be imported to the module with my handlers or which can run stand alaone. I have however a "dummy" which can fake httprequest and the request object (up to the point that the register_cleanup works). Other handlers are not supported (auth, filters etc). I would love to contribute that work into the community but I made it in "paid time" and are not allowed to distribute it.
 
What I did though is very simple, I created a class with all the members, methods etc. I found in the documentation. takes about half a day.
 
When I use it I just replace the from mod_python import apache to from mod_python_dummy import apache...
and I have to set stuff like http headers, URI etc by hand.
 
Things start to be a bit complicated when dealing with logins and sessions or lots of data but at the other hand building it helped me getting into this kind of development (I started on a project without any http (or any other web related techn. knowledge).
 
Martijn

________________________________

Van: mod_python-bounces at modpython.org namens Kurt Häusler
Verzonden: vr 20.06.2008 9:31
Aan: mod_python at modpython.org
Onderwerp: [mod_python] Unit Testing mod_python apps.



Hi, new to the list, couldn't find anything in the archives so sorry if
I am asking a FAQ but I am interested in hearing about any practices for
unit testing mod_python apps. Specifically how to mock the Request
object etc, without running in apache etc. Or any other approaches for
testing handlers that take Request parameters that might involve not
mocking the Request object, or perhaps running within apache afterall.

How do you guys do unit testing basically? What tools and techniques
work well for mod_python apps?

Cheers
Kurt
____________
Virus checked by G DATA AntiVirus
Version: AVKA 18.303 from 19.06.2008
Virus news: www.antiviruslab.com


_______________________________________________
Mod_python mailing list
Mod_python at modpython.org
http://mailman.modpython.org/mailman/listinfo/mod_python


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20080620/f2b99897/attachment-0001.html


More information about the Mod_python mailing list