From 5ff492d38c83de46fb583ff5eb83b737db917410 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sun, 8 Mar 2009 16:24:36 -0400 Subject: When running annotate tests, save the incorrect result for examination. --- test_coverage.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/test_coverage.py b/test_coverage.py index ec86c8d..8dd26ae 100644 --- a/test_coverage.py +++ b/test_coverage.py @@ -147,10 +147,22 @@ class CoverageTest(unittest.TestCase): self.assertEqual(report, rep) if annfile: + # Run annotate. coverage.annotate([modname+'.py']) expect = (path.path(self.olddir) / annfile).text() actual = path.path(modname + '.py,cover').text() - self.assertEqual(expect, actual) + out = path.path(self.olddir) / (annfile + "_actual") + # Check if the results are right + if expect == actual: + # They are right: delete the old test results if they are still + # around. + if out.exists(): + out.remove() + else: + # The results are wrong: write them out so we can diff them to + # see what happened. + out.write_text(actual) + self.fail("Annotation is incorrect: %s" % out) def assertRaisesMsg(self, excClass, msg, callableObj, *args, **kwargs): """ Just like unittest.TestCase.assertRaises, -- cgit v1.2.1