diff --git a/test/runner/lib/target.py b/test/runner/lib/target.py index f1126cfb06..f6051ec73e 100644 --- a/test/runner/lib/target.py +++ b/test/runner/lib/target.py @@ -137,6 +137,7 @@ def filter_targets(targets, patterns, include=True, directories=True, errors=Tru :rtype: collections.Iterable[CompletionTarget] """ unmatched = set(patterns or ()) + compiled_patterns = dict((p, re.compile('^%s$' % p)) for p in patterns) if patterns else None for target in targets: matched_directories = set() @@ -145,7 +146,7 @@ def filter_targets(targets, patterns, include=True, directories=True, errors=Tru if patterns: for alias in target.aliases: for pattern in patterns: - if re.match('^%s$' % pattern, alias): + if compiled_patterns[pattern].match(alias): match = True try: