bpo-31324: Optimize support._match_test() (#4421)

* Rename support._match_test() to support.match_test(): make it
  public
* Remove support.match_tests global variable. It is replaced with a
  new support.set_match_tests() function, so match_test() doesn't
  have to check each time if patterns were modified.
* Rewrite match_test(): use different code paths depending on the
  kind of patterns for best performances.

Co-Authored-By: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
Victor Stinner 2017-11-21 15:34:02 -08:00 committed by GitHub
parent 431665bf19
commit 803ddd8ce2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 111 additions and 15 deletions

View file

@ -257,12 +257,12 @@ class Regrtest:
if isinstance(test, unittest.TestSuite):
self._list_cases(test)
elif isinstance(test, unittest.TestCase):
if support._match_test(test):
if support.match_test(test):
print(test.id())
def list_cases(self):
support.verbose = False
support.match_tests = self.ns.match_tests
support.set_match_tests(self.ns.match_tests)
for test in self.selected:
abstest = get_abs_module(self.ns, test)