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

shush log output from tests.

parent 01ca1d4c
......@@ -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 @@ class TestInitialization( unittest.TestCase ):
i = self.getOne()
self.configure(bad_cfg)
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):
......
......@@ -7,6 +7,7 @@ from AccessControl.User import User # before SpecialUsers
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 @@ import Products.Five
from Products.Five import zcml
from Products.Five.eventconfigure import setDeprecatedManageAddDelete
logger = getLogger('OFS.subscribers')
class FauxRoot( Implicit ):
......@@ -284,7 +286,11 @@ class ObjectManagerTests(PlacelessSetup, unittest.TestCase):
om = self._makeOne()
ob = ItemForDeletion(fail_on_delete=True)
om._setObject(ob.getId(), ob)
try:
logger.disabled = 1
om._delObject(ob.getId())
finally:
logger.disabled = 0
def test_delObject_exception(self):
# Test exception behavior in manage_beforeDelete
......@@ -293,7 +299,11 @@ class ObjectManagerTests(PlacelessSetup, unittest.TestCase):
om = self._makeOne()
ob = ItemForDeletion(fail_on_delete=True)
om._setObject(ob.getId(), ob)
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
......@@ -303,7 +313,11 @@ class ObjectManagerTests(PlacelessSetup, unittest.TestCase):
om = self._makeOne()
ob = ItemForDeletion(fail_on_delete=True)
om._setObject(ob.getId(), ob)
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 @@ class ObjectManagerTests(PlacelessSetup, unittest.TestCase):
om = self._makeOne()
ob = ItemForDeletion(fail_on_delete=True)
om._setObject(ob.getId(), ob)
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 @@ class ObjectManagerTests(PlacelessSetup, unittest.TestCase):
ob = ItemForDeletion(fail_on_delete=True)
om1._setObject('om2', om2, set_owner=False)
om2._setObject(ob.getId(), ob)
try:
logger.disabled = 1
self.assertRaises(DeleteFailed, om1._delObject, 'om2')
finally:
logger.disabled = 0
def test_hasObject(self):
om = self._makeOne()
......
......@@ -170,7 +170,14 @@ class TestProductInit( unittest.TestCase ):
f.write('Syntax Error!')
f.close()
self.configure(cfg)
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
......
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