in teamcity/diff_tools.py [0:0]
def patch_unittest_diff(test_filter=None):
"""
Patches "assertEquals" to throw DiffError.
@:param test_filter callback to check each test. If not None it should return True to test or EqualsAssertionError will be skipped
"""
if sys.version_info < (2, 7):
return
old = unittest.TestCase.assertEqual
def _patched_equals(self, first, second, msg=None):
try:
old(self, first, second, msg)
return
except AssertionError as e:
if not test_filter or test_filter(self):
error = EqualsAssertionError(first, second, msg, real_exception=e)
if error.can_be_serialized():
from .jb_local_exc_store import store_exception
store_exception(error)
raise
unittest.TestCase.assertEqual = _patched_equals