summaryrefslogtreecommitdiff
path: root/coverage/control.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2014-10-26 16:08:29 -0400
committerNed Batchelder <ned@nedbatchelder.com>2014-10-26 16:08:29 -0400
commite9e969c5d733647b4bdaabf1f5e384bc79345326 (patch)
treed9430876aaada2e7afbb1880db76a55994b9862f /coverage/control.py
parent8cd2b7477b1e58cdace3ebcffc343d45a1f4b729 (diff)
downloadpython-coveragepy-e9e969c5d733647b4bdaabf1f5e384bc79345326.tar.gz
Allow the --debug switch on any command
Diffstat (limited to 'coverage/control.py')
-rw-r--r--coverage/control.py46
1 files changed, 23 insertions, 23 deletions
diff --git a/coverage/control.py b/coverage/control.py
index 66979c3..4c08765 100644
--- a/coverage/control.py
+++ b/coverage/control.py
@@ -262,6 +262,29 @@ class Coverage(object):
self._inited = True
+ # Create the matchers we need for _should_trace
+ if self.source or self.source_pkgs:
+ self.source_match = TreeMatcher(self.source)
+ else:
+ if self.cover_dir:
+ self.cover_match = TreeMatcher([self.cover_dir])
+ if self.pylib_dirs:
+ self.pylib_match = TreeMatcher(self.pylib_dirs)
+ if self.include:
+ self.include_match = FnmatchMatcher(self.include)
+ if self.omit:
+ self.omit_match = FnmatchMatcher(self.omit)
+
+ # The user may want to debug things, show info if desired.
+ if self.debug.should('config'):
+ self.debug.write("Configuration values:")
+ config_info = sorted(self.config.__dict__.items())
+ self.debug.write_formatted_info(config_info)
+
+ if self.debug.should('sys'):
+ self.debug.write("Debugging info:")
+ self.debug.write_formatted_info(self.sysinfo())
+
def _canonical_dir(self, morf):
"""Return the canonical directory of the module or file `morf`."""
morf_filename = PythonCodeUnit(morf, self.file_locator).filename
@@ -495,29 +518,6 @@ class Coverage(object):
if self._auto_data:
self.load()
- # Create the matchers we need for _should_trace
- if self.source or self.source_pkgs:
- self.source_match = TreeMatcher(self.source)
- else:
- if self.cover_dir:
- self.cover_match = TreeMatcher([self.cover_dir])
- if self.pylib_dirs:
- self.pylib_match = TreeMatcher(self.pylib_dirs)
- if self.include:
- self.include_match = FnmatchMatcher(self.include)
- if self.omit:
- self.omit_match = FnmatchMatcher(self.omit)
-
- # The user may want to debug things, show info if desired.
- if self.debug.should('config'):
- self.debug.write("Configuration values:")
- config_info = sorted(self.config.__dict__.items())
- self.debug.write_formatted_info(config_info)
-
- if self.debug.should('sys'):
- self.debug.write("Debugging info:")
- self.debug.write_formatted_info(self.sysinfo())
-
self.collector.start()
self._started = True
self._measured = True