Commit 07d19338 authored by Julien Muchembled's avatar Julien Muchembled

tests: disallow assert{Not}Equals and fail{If,Unless}Equal (except in tests.zodb)

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2697 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 37bf8620
......@@ -89,17 +89,17 @@ class NeoTestBase(unittest.TestCase):
sys.stdout.write('\n')
sys.stdout.flush()
def failUnlessEqual(self, first, second, msg=None):
failIfEqual = failUnlessEqual = assertEquals = assertNotEquals = None
def assertNotEqual(self, first, second, msg=None):
assert not (isinstance(first, Mock) or isinstance(second, Mock)), \
"Mock objects can't be compared with '==' or '!='"
return super(NeoTestBase, self).failUnlessEqual(first, second, msg=msg)
assertEqual = assertEquals = failUnlessEqual
return super(NeoTestBase, self).assertNotEqual(first, second, msg=msg)
def failIfEqual(self, first, second, msg=None):
def assertEqual(self, first, second, msg=None):
assert not (isinstance(first, Mock) or isinstance(second, Mock)), \
"Mock objects can't be compared with '==' or '!='"
return super(NeoTestBase, self).failIfEqual(first, second, msg=msg)
assertNotEqual = assertNotEquals = failIfEqual
return super(NeoTestBase, self).assertEqual(first, second, msg=msg)
class NeoUnitTestBase(NeoTestBase):
""" Base class for neo tests, implements common checks """
......
......@@ -46,6 +46,9 @@ class ZODBTestCase(NEOFunctionalTest):
neo.lib.setupLog('CLIENT')
NEOFunctionalTest.tearDown(self)
assertEquals = failUnlessEqual = NEOFunctionalTest.assertEqual
assertNotEquals = failIfEqual = NEOFunctionalTest.assertNotEqual
def open(self, read_only=False):
# required for some tests (see PersitentTests), no-op for NEO ?
self._storage._is_read_only = read_only
......
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