I'm trying to get zope.testbrowser to work in Zope 2.10. After a lot of guesswork (easy_install zope.testbrowser broke my environment, Zope 2.11 isn't setting up session container, used various blogs tips to get adapters right) I got it running and I can now do stuff like browser.open(self.folder.myapp.absolute_url()) in python unit test. However, I have a problem. The app uses ZSQL Methods and when the test finishes the transaction is not rolled back and I'm not interested in manually resetting the test database. Is this so deliberately? Do I really have to manually reset the database?
I noticed that FunctionTestCase (lib/python/Testing/ZopeTestCase/ZopeTestCase.py:116) inherits from functional.Functional which inherits from sandbox.SandBoxed which, although I don't understand it, seems to do things differently to the non-functional approach which inherits from base.TestCase. Although I'm not using it, function.Functional adds the nifty function publish() which I'm not using but it's not a transaction.commit() in it. Why?? And what does that decorator actually do? Peter class Functional(sandbox.Sandboxed): ... __implements__ = (interfaces.IFunctional,) @savestate def publish(self, path, basic=None, env=None, extra=None, request_method='GET', stdin=None, handle_errors=True): '''Publishes the object at 'path' returning a response object.''' ... # Commit the sandbox for good measure transaction.commit() ... -- Peter Bengtsson, work www.fry-it.com home www.peterbe.com hobby www.issuetrackerproduct.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 )