summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES.txt5
-rw-r--r--coverage/control.py8
2 files changed, 13 insertions, 0 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index f96498c7..d9de9e07 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -57,6 +57,10 @@ Version 3.4b1 --- 21 August 2010
- Doctest text files are no longer recorded in the coverage data, since they
can't be reported anyway. Fixes `issue 52`_ and `issue 61`_.
+- Jinja HTML templates compile into Python code using the HTML filename,
+ which confused coverage.py. Now these files are no longer traced, fixing
+ `issue 82`.
+
- Source files can have more than one dot in them (foo.test.py), and will be
treated properly while reporting. Fixes `issue 46`_.
@@ -79,6 +83,7 @@ Version 3.4b1 --- 21 August 2010
.. _issue 61: http://bitbucket.org/ned/coveragepy/issue/61/annotate-i-doesnt-work
.. _issue 62: http://bitbucket.org/ned/coveragepy/issue/62
.. _issue 59: http://bitbucket.org/ned/coveragepy/issue/59/html-report-fails-with-int-object-is
+.. _issue 82: http://bitbucket.org/ned/coveragepy/issue/82/tokenerror-when-generating-html-report
Version 3.3.1 --- 6 March 2010
diff --git a/coverage/control.py b/coverage/control.py
index b7dfa0a8..05a75031 100644
--- a/coverage/control.py
+++ b/coverage/control.py
@@ -198,6 +198,14 @@ class coverage(object):
# can't do anything with the data later anyway.
return False
+ if filename.endswith(".html"):
+ # Jinja and maybe other templating systems compile templates into
+ # Python code, but use the template filename as the filename in
+ # the compiled code. Of course, those filenames are useless later
+ # so don't bother collecting. TODO: How should we really separate
+ # out good file extensions from bad?
+ return False
+
self._check_for_packages()
# Compiled Python files have two filenames: frame.f_code.co_filename is