[Zope] ZopeTestCase.Functional and sessions?

Paul Winkler pw_lists at slinkp.com
Wed Nov 16 13:12:37 EST 2005


Hi,

I've been using CMFTestCase and ZopeTestCase for integration
tests and mostly finding it a pretty nice system to work with
- I can finally test all the glue code in my skin scripts, 
which has always been a big blind spot in my tests.

But one snag I've run into:  ZopeTestCase.utils.setupCoreSessions()
works fine with regular ZopeTestCase and CMFTestCase tests;
but if I create a test derived from ZopeTestCase.Functional,  when I
call self.publish() the thread that handles the publishing (it is
another thread, right?) has its own app.REQUEST which doesn't contain a
SESSION object.

The workaround is obvious:

1) Any script that uses sessions should only be tested with other
   techniques than publish().

2) If you really want to test something about that script with
   publish(), the script should be coded so that it works around
   the possible lack of REQUEST.SESSION.

But it would be nice if I didn't have to enforce that.
#2 means that when I call publish() I am testing a code path
that never actually comes up in production, so that doesn't seem
like much of a real integration test.

Am I missing something?

-- 

Paul Winkler
http://www.slinkp.com


More information about the Zope mailing list