summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO.txt2
-rw-r--r--coverage/parser.py3
-rw-r--r--test/test_coverage.py6
3 files changed, 9 insertions, 2 deletions
diff --git a/TODO.txt b/TODO.txt
index 293ffcca..ebf9ad79 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -7,6 +7,7 @@ Coverage TODO
- parser is doing some redundant work.
- while TRUE claims to be partial?
- Analysis class should do rolling up of stats also.
+- Update docs for --branch.
* Speed
@@ -167,6 +168,7 @@ x Why can't you specify execute (-x) and report (-r) in the same invocation?
+ Switch to a real test runner, like nose.
+ Test both the C trace function and the Python trace function.
+- parser.py has no direct tests.
- Tests about the .coverage file.
+ Tests about the --long-form of arguments.
+ Tests about overriding the .coverage filename.
diff --git a/coverage/parser.py b/coverage/parser.py
index 8c8593cf..7721d8db 100644
--- a/coverage/parser.py
+++ b/coverage/parser.py
@@ -19,7 +19,8 @@ class CodeParser(object):
"""
assert text or filename, "CodeParser needs either text or filename"
self.filename = filename or "<code>"
- if not text:
+ self.text = text
+ if not self.text:
try:
sourcef = open(self.filename, 'rU')
self.text = sourcef.read()
diff --git a/test/test_coverage.py b/test/test_coverage.py
index 7d6df250..d3ba6a44 100644
--- a/test/test_coverage.py
+++ b/test/test_coverage.py
@@ -2,7 +2,7 @@
# Copyright 2004-2009, Ned Batchelder
# http://nedbatchelder.com/code/coverage
-import os, sys, unittest
+import os, re, sys, unittest
import coverage
coverage.use_cache(0)
@@ -1654,10 +1654,12 @@ class ProcessTest(CoverageTest):
# ---------------------------------------------------------------------
# TOTAL 8 8 100%
+ self.assert_("error" not in report1.lower())
self.assert_("/coverage/__init__/" not in report1)
self.assert_("/test/modules/covmod1 " in report1)
self.assert_("/test/zipmods.zip/covmodzip1 " in report1)
self.assert_("mycode " in report1)
+ self.assertEqual(re.sub(r"\s+", " ", report1.split('\n')[-2]), "TOTAL 8 8 100%")
for l in report1.split('\n'):
if '/test/modules/covmod1' in l:
@@ -1672,6 +1674,7 @@ class ProcessTest(CoverageTest):
# ----------------------------
# mycode 4 4 100%
+ self.assert_("error" not in report2.lower())
self.assert_("/coverage/" not in report2)
self.assert_("/test/modules/covmod1 " not in report2)
self.assert_("/test/zipmods.zip/covmodzip1 " not in report2)
@@ -1685,6 +1688,7 @@ class ProcessTest(CoverageTest):
# ----------------------------
# mycode 4 4 100%
+ self.assert_("error" not in report3.lower())
self.assert_("/coverage/" not in report3)
self.assert_("/test/modules/covmod1 " not in report3)
self.assert_("/test/zipmods.zip/covmodzip1 " not in report3)