Mercurial > hgsubversion
comparison tests/test_util.py @ 743:045120d3a110
test_utility_commands: use self.assertMultiLineEqual().
The previous assertStringEqual() utility method pointed to standard
output. This is fairly annoying when running our own test-runner as it
suppresses that output. The assertMultiLineEqual() method shows
essentially the same information in the AssertionError itself.
While at it, all other comparisons that contain line-breaks are made
to use assertMultiLineEqual().
author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
---|---|
date | Thu, 11 Nov 2010 21:30:31 +0100 |
parents | e24fb3e27ec9 |
children | 6d6be5284056 |
comparison
equal
deleted
inserted
replaced
742:0d3139ba2d66 | 743:045120d3a110 |
---|---|
268 rmtree(self.tmpdir) | 268 rmtree(self.tmpdir) |
269 os.chdir(self.oldwd) | 269 os.chdir(self.oldwd) |
270 setattr(ui.ui, self.patch[0].func_name, self.patch[0]) | 270 setattr(ui.ui, self.patch[0].func_name, self.patch[0]) |
271 | 271 |
272 _verify_our_modules() | 272 _verify_our_modules() |
273 | |
274 def assertStringEqual(self, l, r): | |
275 try: | |
276 self.assertEqual(l, r, 'failed string equality check, see stdout for details') | |
277 except: | |
278 add_nl = lambda li: map(lambda x: x+'\n', li) | |
279 print 'failed expectation:' | |
280 print ''.join(difflib.unified_diff( | |
281 add_nl(l.splitlines()), add_nl(r.splitlines()), | |
282 fromfile='expected', tofile='got')) | |
283 raise | |
284 | 273 |
285 def ui(self, stupid=False, layout='auto'): | 274 def ui(self, stupid=False, layout='auto'): |
286 return testui(stupid, layout) | 275 return testui(stupid, layout) |
287 | 276 |
288 def _load_fixture_and_fetch(self, fixture_name, subdir=None, stupid=False, | 277 def _load_fixture_and_fetch(self, fixture_name, subdir=None, stupid=False, |