summaryrefslogtreecommitdiff
path: root/coverage/control.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2009-11-28 17:06:20 -0500
committerNed Batchelder <ned@nedbatchelder.com>2009-11-28 17:06:20 -0500
commitc975721a9cea8716849b1f01a6007d3c3dd3a5fa (patch)
treedeaaac228568486dff4c1499d8f5ce4f4c1049eb /coverage/control.py
parent81a363edf04f614af736ce32d79791a210e1e1fd (diff)
parent2c883bf322dfaa6173efda3805b402b3c0ad1dbb (diff)
downloadpython-coveragepy-git-c975721a9cea8716849b1f01a6007d3c3dd3a5fa.tar.gz
Merged change from default branch
--HG-- branch : config
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 6e18b058..f947816b 100644
--- a/coverage/control.py
+++ b/coverage/control.py
@@ -98,15 +98,22 @@ class coverage(object):
# The prefix for files considered "installed with the interpreter".
if not self.config.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.