From 5c2e817e0606ee912fbb4f44550d8b29cf0cd278 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sat, 8 May 2010 19:19:01 -0400 Subject: Don't trace any files with names starting with less-than. They are all fake, and can't be reported on anyway. Fixes #61. --- CHANGES.txt | 4 ++++ coverage/control.py | 8 +++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 4cdbeff..ccec206 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -19,6 +19,9 @@ Next version and parent processes. Use ``coverage run -p`` to get two data files that can be combined with ``coverage combine``. Fixes `issue 56`_. +- Doctest text files are no longer recorded in the coverage data, since they + can't be reported anyway. Fixes `issue 61`_. + - Source files can have more than one dot in them (foo.test.py), and will be treated properly while reporting. Fixes `issue 46`_. @@ -31,6 +34,7 @@ Next version .. _issue 46: http://bitbucket.org/ned/coveragepy/issue/46 .. _issue 53: http://bitbucket.org/ned/coveragepy/issue/53 .. _issue 56: http://bitbucket.org/ned/coveragepy/issue/56 +.. _issue 61: http://bitbucket.org/ned/coveragepy/issue/61 .. _issue 62: http://bitbucket.org/ned/coveragepy/issue/62 diff --git a/coverage/control.py b/coverage/control.py index a3287ae..e4f5fae 100644 --- a/coverage/control.py +++ b/coverage/control.py @@ -139,9 +139,11 @@ class coverage(object): should not. """ - if filename == '': - # There's no point in ever tracing string executions, we can't do - # anything with the data later anyway. + if filename[0] == '<': + # Lots of non-file execution is represented with artificial + # filenames like "", "", or + # "". Don't ever trace these executions, since we + # can't do anything with the data later anyway. return False # Compiled Python files have two filenames: frame.f_code.co_filename is -- cgit v1.2.1