Re: [Zope] ZopeTestCase.Functional and sessions?
One correction: On Wed, Nov 16, 2005 at 01:12:37PM -0500, Paul Winkler wrote: > 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. That was a bad guess; there's no threading going on there of course, I should've just read the source. What happens is that publish does a transaction.commit(), thus implicitly starting a new request. So the problem remains the same: as far as I can tell there's no way for pages tested with publish() to make use of sessions. -- Paul Winkler http://www.slinkp.com ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] ZopeTestCase.Functional and sessions?
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 ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )