summaryrefslogtreecommitdiff
path: root/coverage/control.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2009-11-28 17:02:26 -0500
committerNed Batchelder <ned@nedbatchelder.com>2009-11-28 17:02:26 -0500
commit2c883bf322dfaa6173efda3805b402b3c0ad1dbb (patch)
tree66d928e7b766dd324b2d03a4f29b9688dd2038dc /coverage/control.py
parent0617b0617e92c57af82b709f39d40e7a26bb7dee (diff)
downloadpython-coveragepy-git-2c883bf322dfaa6173efda3805b402b3c0ad1dbb.tar.gz
A little more detail on how stuff works.
Diffstat (limited to 'coverage/control.py')
-rw-r--r--coverage/control.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/coverage/control.py b/coverage/control.py
index 24fed7b9..674bb15e 100644
--- a/coverage/control.py
+++ b/coverage/control.py
@@ -88,15 +88,22 @@ class coverage(object):
# The prefix for files considered "installed with the interpreter".
if not self.cover_pylib:
+ # Look at where the "os" module is located. That's the indication
+ # for "installed with the interpreter".
os_file = self.file_locator.canonical_filename(os.__file__)
self.pylib_prefix = os.path.split(os_file)[0]
+ # To avoid tracing the coverage code itself, we skip anything located
+ # where we are.
here = self.file_locator.canonical_filename(__file__)
self.cover_prefix = os.path.split(here)[0]
def _should_trace(self, filename, frame):
"""Decide whether to trace execution in `filename`
+ This function is called from the trace function. As each new file name
+ is encountered, this function determines whether it is traced or not.
+
Returns a canonicalized filename if it should be traced, False if it
should not.