Commit 6f07ae8a authored by Andreas Jung's avatar Andreas Jung

getting rid of the zLOG module including some zLOG culprits

in some unittests (if necessary we need to restablish the hacks
in a saner way)
parent a2cd4262
...@@ -20,8 +20,6 @@ import Testing ...@@ -20,8 +20,6 @@ import Testing
import Zope2 import Zope2
Zope2.startup() Zope2.startup()
import zLOG
from Products.PluginIndexes.KeywordIndex.KeywordIndex import KeywordIndex from Products.PluginIndexes.KeywordIndex.KeywordIndex import KeywordIndex
...@@ -78,27 +76,6 @@ class TestKeywordIndex( unittest.TestCase ): ...@@ -78,27 +76,6 @@ class TestKeywordIndex( unittest.TestCase ):
""" """
""" """
def _catch_log_errors( self ):
if self._old_log_write is not None:
return
def log_write(subsystem, severity, summary, detail, error,
PROBLEM=zLOG.PROBLEM):
if severity > PROBLEM:
assert 0, "%s(%s): %s" % (subsystem, severity, summary)
self._old_log_write = zLOG.log_write
zLOG.log_write = log_write
def _ignore_log_errors( self ):
if self._old_log_write is None:
return
zLOG.log_write = self._old_log_write
del self._old_log_write
def _populateIndex( self ): def _populateIndex( self ):
for k, v in self._values: for k, v in self._values:
self._index.index_object( k, v ) self._index.index_object( k, v )
...@@ -126,12 +103,11 @@ class TestKeywordIndex( unittest.TestCase ): ...@@ -126,12 +103,11 @@ class TestKeywordIndex( unittest.TestCase ):
def testAddObjectWOKeywords(self): def testAddObjectWOKeywords(self):
self._catch_log_errors()
try: try:
self._populateIndex() self._populateIndex()
self._index.index_object(999, None) self._index.index_object(999, None)
finally: finally:
self._ignore_log_errors() pass
def testEmpty( self ): def testEmpty( self ):
assert len( self._index ) == 0 assert len( self._index ) == 0
...@@ -236,12 +212,11 @@ class TestKeywordIndex( unittest.TestCase ): ...@@ -236,12 +212,11 @@ class TestKeywordIndex( unittest.TestCase ):
self._checkApply( record, self._values[6:7] ) self._checkApply( record, self._values[6:7] )
def testDuplicateKeywords(self): def testDuplicateKeywords(self):
self._catch_log_errors()
try: try:
self._index.index_object(0, Dummy(['a', 'a', 'b', 'b'])) self._index.index_object(0, Dummy(['a', 'a', 'b', 'b']))
self._index.unindex_object(0) self._index.unindex_object(0)
finally: finally:
self._ignore_log_errors() pass
def testCollectorIssue889(self) : def testCollectorIssue889(self) :
# Test that collector issue 889 is solved # Test that collector issue 889 is solved
......
...@@ -20,12 +20,6 @@ import Testing ...@@ -20,12 +20,6 @@ import Testing
import Zope2 import Zope2
Zope2.startup() Zope2.startup()
import zLOG
def log_write(subsystem, severity, summary, detail, error):
if severity >= zLOG.PROBLEM:
assert 0, "%s(%s): %s" % (subsystem, severity, summary)
import ZODB import ZODB
from ZODB.MappingStorage import MappingStorage from ZODB.MappingStorage import MappingStorage
import transaction import transaction
...@@ -56,8 +50,6 @@ class Tests(unittest.TestCase): ...@@ -56,8 +50,6 @@ class Tests(unittest.TestCase):
def setUp(self): def setUp(self):
self.index=TextIndex.TextIndex('text') self.index=TextIndex.TextIndex('text')
self.doc=Dummy(text='this is the time, when all good zopes') self.doc=Dummy(text='this is the time, when all good zopes')
self.old_log_write = zLOG.log_write
zLOG.log_write=log_write
def dbopen(self): def dbopen(self):
if self.db is None: if self.db is None:
...@@ -84,7 +76,6 @@ class Tests(unittest.TestCase): ...@@ -84,7 +76,6 @@ class Tests(unittest.TestCase):
if self.db is not None: if self.db is not None:
self.db.close() self.db.close()
self.db = None self.db = None
zLOG.log_write=self.old_log_write
def test_z3interfaces(self): def test_z3interfaces(self):
from Products.PluginIndexes.interfaces import IPluggableIndex from Products.PluginIndexes.interfaces import IPluggableIndex
......
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