Update of /cvs-repository/Products/PluginIndexes/common/tests In directory cvs.zope.org:/tmp/cvs-serv5467/lib/python/Products/PluginIndexes/common/tests
Added Files: Tag: Zope-2_7-branch __init__.py test_UnIndex.py Log Message: Collector #1832: UnIndex swallowed ConflictErrors (bare 'except:' is evil). === Added File Products/PluginIndexes/common/tests/__init__.py === ############################################################################## # # Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE # ############################################################################# === Added File Products/PluginIndexes/common/tests/test_UnIndex.py === ############################################################################## # # Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE # ############################################################################# """ Tests for common UnIndex features. $Id: test_UnIndex.py,v 1.1.2.1 2005/07/05 14:10:11 tseaver Exp $ """ import unittest class UnIndexTests(unittest.TestCase): def _getTargetClass(self): from Products.PluginIndexes.common.UnIndex import UnIndex return UnIndex def _makeOne(self, *args, **kw): return self._getTargetClass()(*args, **kw) def _makeConflicted(self): from ZODB.POSException import ConflictError class Conflicted: def __str__(self): return 'Conflicted' __repr__ = __str__ def __getattr__(self, id, default=object()): raise ConflictError, 'testing' return Conflicted() def test_empty(self): unindex = self._makeOne(id='empty') self.assertEqual(unindex.indexed_attrs, ['empty']) def test_removeForwardIndexEntry_with_ConflictError(self): from ZODB.POSException import ConflictError unindex = self._makeOne(id='conflicted') unindex._index['conflicts'] = self._makeConflicted() self.assertRaises(ConflictError, unindex.removeForwardIndexEntry, 'conflicts', 42) def test_suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(UnIndexTests)) return suite if __name__ == '__main__': unittest.main(defaultTest='test_suite') _______________________________________________ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins