diff options
author | Buck Golemon <buck@yelp.com> | 2014-11-14 14:00:27 -0800 |
---|---|---|
committer | Buck Golemon <buck@yelp.com> | 2014-11-14 14:00:27 -0800 |
commit | f8b9153791455b6d09ec80d507c300f33b1da5a1 (patch) | |
tree | 5316cb85ff52e7ea14b059cd5b66c3b1d463fc19 /coverage/files.py | |
parent | 05be6e3d5fc76a403918ad47d9c083191f588f0f (diff) | |
download | python-coveragepy-f8b9153791455b6d09ec80d507c300f33b1da5a1.tar.gz |
ModuleFinder no longer takes a main-module argument.
Diffstat (limited to 'coverage/files.py')
-rw-r--r-- | coverage/files.py | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/coverage/files.py b/coverage/files.py index 5e7c35a..97888b6 100644 --- a/coverage/files.py +++ b/coverage/files.py @@ -175,21 +175,16 @@ class TreeMatcher(object): class ModuleMatcher(object): """A matcher for files in a tree.""" - def __init__(self, module_names, main_module=None): + def __init__(self, module_names): self.modules = list(module_names) - self.main_module = main_module self.not_imported = list(module_names) def __repr__(self): - if self.main_module: - main_module = ', main_module=%r' % self.main_module - else: - main_module = '' - return "<ModuleMatcher %r%s>" % (self.modules, main_module) + return "<ModuleMatcher %r>" % (self.modules) def info(self): """A list of strings for displaying when dumping state.""" - return ['main_module=%r' % self.main_module] + self.modules + return self.modules def add(self, module): """Add another directory to the list we match for.""" @@ -197,22 +192,17 @@ class ModuleMatcher(object): def match(self, module_name): """Does `module_name` indicate a module in one of our packages? - - On success, returns the matched module name, which can be different in - the case of __main__. """ if not module_name: return False - elif module_name == '__main__': - module_name = self.main_module or module_name for m in self.modules: if module_name.startswith(m): if module_name == m: - return module_name + return True if module_name[len(m)] == '.': # This is a module in the package - return module_name + return True return False |