[Zope-Checkins] SVN: Zope/branches/2.9/lib/python/OFS/tests/test shush log output from tests.

Chris Withers chris at simplistix.co.uk
Mon May 1 10:27:56 EDT 2006


Log message for revision 67801:
  shush log output from tests.

Changed:
  U   Zope/branches/2.9/lib/python/OFS/tests/testAppInitializer.py
  U   Zope/branches/2.9/lib/python/OFS/tests/testObjectManager.py
  U   Zope/branches/2.9/lib/python/OFS/tests/testProductInit.py

-=-
Modified: Zope/branches/2.9/lib/python/OFS/tests/testAppInitializer.py
===================================================================
--- Zope/branches/2.9/lib/python/OFS/tests/testAppInitializer.py	2006-05-01 14:27:29 UTC (rev 67800)
+++ Zope/branches/2.9/lib/python/OFS/tests/testAppInitializer.py	2006-05-01 14:27:56 UTC (rev 67801)
@@ -14,6 +14,8 @@
 
 import os, sys, unittest, tempfile, cStringIO
 
+from logging import getLogger
+
 import ZODB
 from OFS.Application import Application, AppInitializer, get_products
 import Zope2.Startup
@@ -121,7 +123,12 @@
 
         i = self.getOne()
         self.configure(bad_cfg)
-        status = i.install_tempfolder_and_sdc()
+        try:
+            logger = getLogger('Zope.ZODBMountPoint')
+            logger.disabled = 1
+            status = i.install_tempfolder_and_sdc()
+        finally:
+            logger.disabled = 0
         self.failIf(status)
 
     def test_install_tempfolder_and_sdc_unlimited_sessions(self):

Modified: Zope/branches/2.9/lib/python/OFS/tests/testObjectManager.py
===================================================================
--- Zope/branches/2.9/lib/python/OFS/tests/testObjectManager.py	2006-05-01 14:27:29 UTC (rev 67800)
+++ Zope/branches/2.9/lib/python/OFS/tests/testObjectManager.py	2006-05-01 14:27:56 UTC (rev 67801)
@@ -7,6 +7,7 @@
 from AccessControl.SpecialUsers import emergency_user, nobody, system
 from Acquisition import Implicit
 from App.config import getConfiguration
+from logging import getLogger
 from OFS.ObjectManager import ObjectManager
 from OFS.SimpleItem import SimpleItem
 from zope.app.testing.placelesssetup import PlacelessSetup
@@ -14,6 +15,7 @@
 from Products.Five import zcml
 from Products.Five.eventconfigure import setDeprecatedManageAddDelete
 
+logger = getLogger('OFS.subscribers')            
 
 class FauxRoot( Implicit ):
 
@@ -284,7 +286,11 @@
         om = self._makeOne()
         ob = ItemForDeletion(fail_on_delete=True)
         om._setObject(ob.getId(), ob)
-        om._delObject(ob.getId())
+        try:
+            logger.disabled = 1
+            om._delObject(ob.getId())
+        finally:
+            logger.disabled = 0
 
     def test_delObject_exception(self):
         # Test exception behavior in manage_beforeDelete
@@ -293,8 +299,12 @@
         om = self._makeOne()
         ob = ItemForDeletion(fail_on_delete=True)
         om._setObject(ob.getId(), ob)
-        om._delObject(ob.getId())
-
+        try:
+            logger.disabled = 1
+            om._delObject(ob.getId())
+        finally:
+            logger.disabled = 0
+        
     def test_delObject_exception_debug_manager(self):
         # Test exception behavior in manage_beforeDelete in debug mode
         # Manager user
@@ -303,7 +313,11 @@
         om = self._makeOne()
         ob = ItemForDeletion(fail_on_delete=True)
         om._setObject(ob.getId(), ob)
-        om._delObject(ob.getId())
+        try:
+            logger.disabled = 1
+            om._delObject(ob.getId())
+        finally:
+            logger.disabled = 0
 
     def test_delObject_exception_debug(self):
         # Test exception behavior in manage_beforeDelete in debug mode
@@ -313,7 +327,11 @@
         om = self._makeOne()
         ob = ItemForDeletion(fail_on_delete=True)
         om._setObject(ob.getId(), ob)
-        self.assertRaises(DeleteFailed, om._delObject, ob.getId())
+        try:
+            logger.disabled = 1
+            self.assertRaises(DeleteFailed, om._delObject, ob.getId())
+        finally:
+            logger.disabled = 0
 
     def test_delObject_exception_debug_deep(self):
         # Test exception behavior in manage_beforeDelete in debug mode
@@ -325,7 +343,11 @@
         ob = ItemForDeletion(fail_on_delete=True)
         om1._setObject('om2', om2, set_owner=False)
         om2._setObject(ob.getId(), ob)
-        self.assertRaises(DeleteFailed, om1._delObject, 'om2')
+        try:
+            logger.disabled = 1
+            self.assertRaises(DeleteFailed, om1._delObject, 'om2')
+        finally:
+            logger.disabled = 0
 
     def test_hasObject(self):
         om = self._makeOne()

Modified: Zope/branches/2.9/lib/python/OFS/tests/testProductInit.py
===================================================================
--- Zope/branches/2.9/lib/python/OFS/tests/testProductInit.py	2006-05-01 14:27:29 UTC (rev 67800)
+++ Zope/branches/2.9/lib/python/OFS/tests/testProductInit.py	2006-05-01 14:27:56 UTC (rev 67801)
@@ -170,7 +170,14 @@
         f.write('Syntax Error!')
         f.close()
         self.configure(cfg)
-        self.assertRaises(SyntaxError, self.import_bad_product)
+        try:
+            from logging import getLogger
+            logger = getLogger('Zope')
+            logger.disabled = 1
+            self.assertRaises(SyntaxError, self.import_bad_product)
+        finally:
+            logger.disabled = 0
+            
 
     def import_bad_product(self):
         from OFS.Application import import_product



More information about the Zope-Checkins mailing list