Commit 16e6b975 authored by Chris Withers's avatar Chris Withers

shush log output from tests.

parent 01ca1d4c
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
import os, sys, unittest, tempfile, cStringIO import os, sys, unittest, tempfile, cStringIO
from logging import getLogger
import ZODB import ZODB
from OFS.Application import Application, AppInitializer, get_products from OFS.Application import Application, AppInitializer, get_products
import Zope2.Startup import Zope2.Startup
...@@ -121,7 +123,12 @@ class TestInitialization( unittest.TestCase ): ...@@ -121,7 +123,12 @@ class TestInitialization( unittest.TestCase ):
i = self.getOne() i = self.getOne()
self.configure(bad_cfg) 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) self.failIf(status)
def test_install_tempfolder_and_sdc_unlimited_sessions(self): def test_install_tempfolder_and_sdc_unlimited_sessions(self):
......
...@@ -7,6 +7,7 @@ from AccessControl.User import User # before SpecialUsers ...@@ -7,6 +7,7 @@ from AccessControl.User import User # before SpecialUsers
from AccessControl.SpecialUsers import emergency_user, nobody, system from AccessControl.SpecialUsers import emergency_user, nobody, system
from Acquisition import Implicit from Acquisition import Implicit
from App.config import getConfiguration from App.config import getConfiguration
from logging import getLogger
from OFS.ObjectManager import ObjectManager from OFS.ObjectManager import ObjectManager
from OFS.SimpleItem import SimpleItem from OFS.SimpleItem import SimpleItem
from zope.app.testing.placelesssetup import PlacelessSetup from zope.app.testing.placelesssetup import PlacelessSetup
...@@ -14,6 +15,7 @@ import Products.Five ...@@ -14,6 +15,7 @@ import Products.Five
from Products.Five import zcml from Products.Five import zcml
from Products.Five.eventconfigure import setDeprecatedManageAddDelete from Products.Five.eventconfigure import setDeprecatedManageAddDelete
logger = getLogger('OFS.subscribers')
class FauxRoot( Implicit ): class FauxRoot( Implicit ):
...@@ -284,7 +286,11 @@ class ObjectManagerTests(PlacelessSetup, unittest.TestCase): ...@@ -284,7 +286,11 @@ class ObjectManagerTests(PlacelessSetup, unittest.TestCase):
om = self._makeOne() om = self._makeOne()
ob = ItemForDeletion(fail_on_delete=True) ob = ItemForDeletion(fail_on_delete=True)
om._setObject(ob.getId(), ob) 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): def test_delObject_exception(self):
# Test exception behavior in manage_beforeDelete # Test exception behavior in manage_beforeDelete
...@@ -293,8 +299,12 @@ class ObjectManagerTests(PlacelessSetup, unittest.TestCase): ...@@ -293,8 +299,12 @@ class ObjectManagerTests(PlacelessSetup, unittest.TestCase):
om = self._makeOne() om = self._makeOne()
ob = ItemForDeletion(fail_on_delete=True) ob = ItemForDeletion(fail_on_delete=True)
om._setObject(ob.getId(), ob) 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): def test_delObject_exception_debug_manager(self):
# Test exception behavior in manage_beforeDelete in debug mode # Test exception behavior in manage_beforeDelete in debug mode
# Manager user # Manager user
...@@ -303,7 +313,11 @@ class ObjectManagerTests(PlacelessSetup, unittest.TestCase): ...@@ -303,7 +313,11 @@ class ObjectManagerTests(PlacelessSetup, unittest.TestCase):
om = self._makeOne() om = self._makeOne()
ob = ItemForDeletion(fail_on_delete=True) ob = ItemForDeletion(fail_on_delete=True)
om._setObject(ob.getId(), ob) 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): def test_delObject_exception_debug(self):
# Test exception behavior in manage_beforeDelete in debug mode # Test exception behavior in manage_beforeDelete in debug mode
...@@ -313,7 +327,11 @@ class ObjectManagerTests(PlacelessSetup, unittest.TestCase): ...@@ -313,7 +327,11 @@ class ObjectManagerTests(PlacelessSetup, unittest.TestCase):
om = self._makeOne() om = self._makeOne()
ob = ItemForDeletion(fail_on_delete=True) ob = ItemForDeletion(fail_on_delete=True)
om._setObject(ob.getId(), ob) 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): def test_delObject_exception_debug_deep(self):
# Test exception behavior in manage_beforeDelete in debug mode # Test exception behavior in manage_beforeDelete in debug mode
...@@ -325,7 +343,11 @@ class ObjectManagerTests(PlacelessSetup, unittest.TestCase): ...@@ -325,7 +343,11 @@ class ObjectManagerTests(PlacelessSetup, unittest.TestCase):
ob = ItemForDeletion(fail_on_delete=True) ob = ItemForDeletion(fail_on_delete=True)
om1._setObject('om2', om2, set_owner=False) om1._setObject('om2', om2, set_owner=False)
om2._setObject(ob.getId(), ob) 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): def test_hasObject(self):
om = self._makeOne() om = self._makeOne()
......
...@@ -170,7 +170,14 @@ class TestProductInit( unittest.TestCase ): ...@@ -170,7 +170,14 @@ class TestProductInit( unittest.TestCase ):
f.write('Syntax Error!') f.write('Syntax Error!')
f.close() f.close()
self.configure(cfg) 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): def import_bad_product(self):
from OFS.Application import import_product from OFS.Application import import_product
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment