Log message for revision 30126: Explicitly close connections to "sandbox" databases.
Changed: U Zope/trunk/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt U Zope/trunk/lib/python/Testing/ZopeTestCase/sandbox.py U Zope/trunk/lib/python/Testing/ZopeTestCase/testShoppingCart.py -=- Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt =================================================================== --- Zope/trunk/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt 2005-04-23 09:58:24 UTC (rev 30125) +++ Zope/trunk/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt 2005-04-23 18:50:39 UTC (rev 30126) @@ -10,6 +10,8 @@ - ZopeLite now takes care not to monkey patch an already started Zope. - PortalTestCase no longer calls _refreshSkinData() as CMF is smart enough now (and CMF 1.5+ does not work that way anyway). +- Fixed a bug where using sessions in sandboxed (functional) tests would cause + connection pool depletion and subsequent hangs. Thanks to Balazs Ree. 0.9.6 - Dropped support for Zope 2.5 as it lacks the setSecurityManager() API. Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/sandbox.py =================================================================== --- Zope/trunk/lib/python/Testing/ZopeTestCase/sandbox.py 2005-04-23 09:58:24 UTC (rev 30125) +++ Zope/trunk/lib/python/Testing/ZopeTestCase/sandbox.py 2005-04-23 18:50:39 UTC (rev 30126) @@ -17,6 +17,7 @@ import ZopeLite as Zope2 import transaction +import base import utils @@ -31,6 +32,7 @@ def _app(self): '''Returns the app object for a test.''' app = Zope2.app(Zope2.sandbox().open()) + base._connections.register(app._p_jar) AppZapper().set(app) return utils.makerequest(app) @@ -38,6 +40,7 @@ '''Clears the transaction and the AppZapper.''' transaction.abort() AppZapper().clear() + base.closeConnections() class AppZapper: Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/testShoppingCart.py =================================================================== --- Zope/trunk/lib/python/Testing/ZopeTestCase/testShoppingCart.py 2005-04-23 09:58:24 UTC (rev 30125) +++ Zope/trunk/lib/python/Testing/ZopeTestCase/testShoppingCart.py 2005-04-23 18:50:39 UTC (rev 30126) @@ -105,11 +105,27 @@ self.cart.addItems([DummyOrder('510-007', 2),]) self.assertEqual(self.cart.getTotal(), 149.95) + def testGetItem(self): + # Getting an item from the "database" should work + item = self.cart.getItem('510-115') + self.assertEqual(item['id'], '510-115') + self.assertEqual(item['title'], 'Econo Feeder') + self.assertEqual(item['price'], 7.95) + def testEight(self): + # Additional test to trigger connection pool depletion bug + pass + + +class TestSandboxedShoppingCart(ZopeTestCase.Sandboxed, TestShoppingCart): + '''Demonstrate that sessions work in sandboxes''' + + def test_suite(): from unittest import TestSuite, makeSuite suite = TestSuite() suite.addTest(makeSuite(TestShoppingCart)) + suite.addTest(makeSuite(TestSandboxedShoppingCart)) return suite if __name__ == '__main__': _______________________________________________ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins