File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed
Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -242,6 +242,7 @@ class ModuleMatcher(object):
242242 """A matcher for modules in a tree."""
243243 def __init__ (self , module_names ):
244244 self .modules = list (module_names )
245+ self .module_patterns = [re .compile (m ) for m in self .modules ]
245246
246247 def __repr__ (self ):
247248 return "<ModuleMatcher %r>" % (self .modules )
@@ -263,6 +264,10 @@ def match(self, module_name):
263264 # This is a module in the package
264265 return True
265266
267+ for pattern in self .module_patterns :
268+ if pattern .match (module_name ):
269+ return True
270+
266271 return False
267272
268273
Original file line number Diff line number Diff line change @@ -174,12 +174,15 @@ def test_tree_matcher(self):
174174 def test_module_matcher (self ):
175175 matches_to_try = [
176176 ('test' , True ),
177+ ('te.*' , True ),
177178 ('trash' , False ),
179+ ('tra.*' , False ),
178180 ('testing' , False ),
179181 ('test.x' , True ),
180182 ('test.x.y.z' , True ),
181183 ('py' , False ),
182184 ('py.t' , False ),
185+ ('py.t.*' , True ),
183186 ('py.test' , True ),
184187 ('py.testing' , False ),
185188 ('py.test.buz' , True ),
You can’t perform that action at this time.
0 commit comments