summaryrefslogtreecommitdiff
path: root/test_coverage.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2009-03-08 16:24:36 -0400
committerNed Batchelder <ned@nedbatchelder.com>2009-03-08 16:24:36 -0400
commite51f1781f92eeafab040d0c8fa2762e6eac7b3ce (patch)
treeec1772914fd1feffab1593ce8d73ed3a3acd13ba /test_coverage.py
parent966e2e8b0f9937b8146e4cac6720d0aeef268784 (diff)
downloadpython-coveragepy-git-e51f1781f92eeafab040d0c8fa2762e6eac7b3ce.tar.gz
When running annotate tests, save the incorrect result for examination.
Diffstat (limited to 'test_coverage.py')
-rw-r--r--test_coverage.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/test_coverage.py b/test_coverage.py
index ec86c8d6..8dd26ae2 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,