[zope2-tracker] [Bug 694986] [NEW] ZopeTestCase is missing ZODB connection isolation

Wolfgang Schnerring wosc at wosc.de
Tue Dec 28 06:35:59 EST 2010


Public bug reported:

Hello,

I've stumbled upon an issue with Testing.ZopeTestCase.sandbox: it sets
everything up so that there only ever is one single ZODB connection
per test, that is shared among all requests, the test code,
everything.

While that's more or less fine for the usual functional tests (using
testbrowser or whatnot), it doesn't work well when you want to go
through HTTP (with Selenium, for example) -- especially not when you
want more than one thread to handle HTTP requests.

I have implemented a patch[1] that fixes this issue which I'm using in
gocept.selenium, passing specific tests of the problematic behaviour[2].

Wolfgang

[1] see
http://zope3.pov.lt/trac/browser/gocept.selenium/trunk/src/gocept/selenium/zope2/__init__.py#L48
inlining here for convenience:

Testing.ZopeTestCase.sandbox.Sandbox:
    def _app(self):
	Zope2.startup()
	stuff = Zope2.bobo_application._stuff
	db = Testing.ZopeTestCase.ZopeLite.sandbox()
	Zope2.bobo_application._stuff = (db,) + stuff[1:]
	app = Zope2.bobo_application()
	app = Testing.ZopeTestCase.utils.makerequest(app)
	Testing.ZopeTestCase.connections.register(app)
        return app

[2] see
http://zope3.pov.lt/trac/browser/gocept.selenium/trunk/src/gocept/selenium/tests/isolation
http://zope3.pov.lt/trac/browser/gocept.selenium/trunk/src/gocept/selenium/zope2/tests/zope212/test_zope212.py

** Affects: zope2
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Zope 2
Developers, which is subscribed to Zope 2.
https://bugs.launchpad.net/bugs/694986

Title:
  ZopeTestCase is missing ZODB connection isolation


More information about the zope2-tracker mailing list