summaryrefslogtreecommitdiff
path: root/coverage/control.py
diff options
context:
space:
mode:
authorwonwinmcbrootles@Wonwin-McBrootles-Computer.local <wonwinmcbrootles@Wonwin-McBrootles-Computer.local>2010-05-09 22:25:41 -0600
committerwonwinmcbrootles@Wonwin-McBrootles-Computer.local <wonwinmcbrootles@Wonwin-McBrootles-Computer.local>2010-05-09 22:25:41 -0600
commitc2b6a46547f05dd7b89c1a8484c10cd02c34e542 (patch)
tree2fa5ace7cb4dcfb3303fc574158ceee0aa4873bc /coverage/control.py
parentce4dbf3b92dcccf146cdf8c0bfb2f6da0a7c5dd5 (diff)
downloadpython-coveragepy-git-c2b6a46547f05dd7b89c1a8484c10cd02c34e542.tar.gz
fix a couple of bugs in control.py such that handling of omit_prefixes and/or require_prefixes was wrong
update cmdline tests so they don't go red due to an unexpected constructor argument 'require_prefixes' note that there is not a real test of the "--require" cmdline argument -- I just added "require_prefixes=None" to the tests, so there is not test which tests what happens when someone passes --require= to the summary commands, much less to the run command. --HG-- extra : transplant_source : %F7%B3%26E%27Va%A2W4%9EX%9F%02oV%3C%A2%27%E1
Diffstat (limited to 'coverage/control.py')
-rw-r--r--coverage/control.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/coverage/control.py b/coverage/control.py
index a337d6bd..2c774ae6 100644
--- a/coverage/control.py
+++ b/coverage/control.py
@@ -102,8 +102,12 @@ class coverage(object):
if self.config.omit_prefixes:
self.omit_prefixes = [self.file_locator.abs_file(p) for p in self.config.omit_prefixes]
+ else:
+ self.omit_prefixes = []
if self.config.require_prefixes:
self.require_prefixes = [self.file_locator.abs_file(p) for p in self.config.require_prefixes]
+ else:
+ self.require_prefixes = []
self.collector = Collector(
self._should_trace, timid=self.config.timid,
@@ -192,12 +196,9 @@ class coverage(object):
return canonical
else:
return False
- elif omit_prefixes:
- for prefix in prefixes:
- if canonical.startswith(prefix):
- return False
-
- code_units = filtered
+ for prefix in self.omit_prefixes:
+ if canonical.startswith(prefix):
+ return False
return canonical