File tree 2 files changed +8
-0
lines changed
2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -242,6 +242,7 @@ class ModuleMatcher(object):
242
242
"""A matcher for modules in a tree."""
243
243
def __init__ (self , module_names ):
244
244
self .modules = list (module_names )
245
+ self .module_patterns = [re .compile (m ) for m in self .modules ]
245
246
246
247
def __repr__ (self ):
247
248
return "<ModuleMatcher %r>" % (self .modules )
@@ -263,6 +264,10 @@ def match(self, module_name):
263
264
# This is a module in the package
264
265
return True
265
266
267
+ for pattern in self .module_patterns :
268
+ if pattern .match (module_name ):
269
+ return True
270
+
266
271
return False
267
272
268
273
Original file line number Diff line number Diff line change @@ -174,12 +174,15 @@ def test_tree_matcher(self):
174
174
def test_module_matcher (self ):
175
175
matches_to_try = [
176
176
('test' , True ),
177
+ ('te.*' , True ),
177
178
('trash' , False ),
179
+ ('tra.*' , False ),
178
180
('testing' , False ),
179
181
('test.x' , True ),
180
182
('test.x.y.z' , True ),
181
183
('py' , False ),
182
184
('py.t' , False ),
185
+ ('py.t.*' , True ),
183
186
('py.test' , True ),
184
187
('py.testing' , False ),
185
188
('py.test.buz' , True ),
You can’t perform that action at this time.
0 commit comments