Related to the thread about how best to set up CMFTestCase... I'm just wondering if I'm doing anything non-kosher by deriving from both CMFTestCase and ZopeTestCase.Sandboxed, which theoretically should prevent any ZODB-pollution as long as I don't do the global CMF site setup.
It mostly seems to work, but as far as I can tell, you *must* inherit in exactly that order, i.e. class MyTest(ZopeTestCase.Sandboxed, CMFTestCase.CMFTestCase): def getPortal(self): CMFTestCase.setupCMFSite() return getattr(self.app, CMFTestCase.portal_name) ... The inheritance order should probably be documented somewhere. If I switch the order, I get lots of barfing on getPortal() calls, the getattr() fails. .... Ahhh, I see; setupCMFSite() does its own call to ZopeTestCase.app(). Hmm, could it take an optional app argument? That would allow it to be used like so: def getPortal(self): CMFTestCase.setupCMFSite(app=self.app) return getattr(self.app, CMFTestCase.portal_name) The modified setup function could be like so: def setupCMFSite(id=portal_name, quiet=0, app=None): '''Creates a CMF site.''' if app is None: app = ZopeTestCase.app() close = ZopeTestCase.close else: # Don't clase the app if it already existed. def close(the_app): pass _setupCMFSite(app, id, quiet) close(app) That seems to pass all tests with CMFTestCase, and hey presto, my own product's tests work with it too and now the inheritance order no longer seems to matter. Thoughts? Stefan? -- Paul Winkler http://www.slinkp.com _______________________________________________ Zope-CMF maillist - Zope-CMF@lists.zope.org http://mail.zope.org/mailman/listinfo/zope-cmf See http://collector.zope.org/CMF for bug reports and feature requests