diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2012-11-22 23:27:34 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2012-11-22 23:27:34 -0500 |
commit | f294f675bd7161f44a439d71cc1dd90269c030dc (patch) | |
tree | b761efdb22de199d4796e5b2d9fd1440fc635282 /coverage/control.py | |
parent | 562a2b45668b54145ad1056827e065dc4759d398 (diff) | |
download | python-coveragepy-git-f294f675bd7161f44a439d71cc1dd90269c030dc.tar.gz |
Work harder to find where the coverage code actually is, so we can avoid counting it. WIP #74.
Diffstat (limited to 'coverage/control.py')
-rw-r--r-- | coverage/control.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/coverage/control.py b/coverage/control.py index f80e62b6..cee06ca5 100644 --- a/coverage/control.py +++ b/coverage/control.py @@ -161,7 +161,7 @@ class coverage(object): # we've imported, and take all the different ones. for m in (atexit, os, random, socket): if hasattr(m, "__file__"): - m_dir = self._canonical_dir(m.__file__) + m_dir = self._canonical_dir(m) if m_dir not in self.pylib_dirs: self.pylib_dirs.append(m_dir) @@ -180,9 +180,9 @@ class coverage(object): # Set the reporting precision. Numbers.set_precision(self.config.precision) - def _canonical_dir(self, f): - """Return the canonical directory of the file `f`.""" - return os.path.split(self.file_locator.canonical_filename(f))[0] + def _canonical_dir(self, morf): + """Return the canonical directory of the module or file `morf`.""" + return os.path.split(CodeUnit(morf, self.file_locator).filename)[0] def _source_for_file(self, filename): """Return the source file for `filename`.""" |