[mod_python] mod_python and unittest

Sean Abrahams abrahams at gmail.com
Fri Jul 23 16:59:11 EDT 2004


I've looked in the test directory and figured things out.

However for simple tests, would it not be easier to simply create a
mock request object?

Right now I just want a unittest for my session mutator functions.

I can imagine there are tests that will require setting up an http
instance and yadda, yadda, yadda, but for simple stuff, I'm thinking a
mock request object will do.

Does anyone see any reasons not to use a mock request object?

Perhaps a, from mod_python import mockreq ?? ;)

I just want to have a little dialog to ensure my effort to create a
mockreq module would be worthwhile.

Thanks,
--Sean


On Fri, 9 Jul 2004 19:20:48 -0400 (EDT), Gregory (Grisha) Trubetskoy
<grisha at modpython.org> wrote:
> 
> Sean -
> 
> Take a look at the test subdirectory of the source distribution. It
> contains a bunch of mod_python tests. You're right, it's not that simple
> because you actually have to run httpd and make a request to conduct a
> test.
> 
> Grisha
> 
> 
> 
> On Fri, 9 Jul 2004, Sean Abrahams wrote:
> 
> > What's the best way to use python's unittest module with mod_python?
> >
> > Unless I'm missing something, I can't just 'from mod_python import
> > apache' and create my own req object without it being run under
> > Apache. I was thinking I should just create a mock req object for
> > simple tests, thoughts?
> >
> > Thanks,
> > --Sean
> > _______________________________________________
> > Mod_python mailing list
> > Mod_python at modpython.org
> > http://mailman.modpython.org/mailman/listinfo/mod_python
> >
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>


More information about the Mod_python mailing list