Mercurial > hg
comparison tests/run-tests.py @ 41141:89d103fc9c19
testrunner: avoid capturing a regex group we don't care about
Differential Revision: https://phab.mercurial-scm.org/D5536
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 08 Jan 2019 22:07:47 -0800 |
parents | 8ddc5d8bea25 |
children | 53327bfbf35d |
comparison
equal
deleted
inserted
replaced
41140:92a5fb73b3d5 | 41141:89d103fc9c19 |
---|---|
2784 expanded_args.extend([arg + a for a in os.listdir(arg)]) | 2784 expanded_args.extend([arg + a for a in os.listdir(arg)]) |
2785 else: | 2785 else: |
2786 expanded_args.append(arg) | 2786 expanded_args.append(arg) |
2787 args = expanded_args | 2787 args = expanded_args |
2788 | 2788 |
2789 testcasepattern = re.compile(br'([\w-]+\.t|py)(#([a-zA-Z0-9_\-\.#]+))') | 2789 testcasepattern = re.compile( |
2790 br'([\w-]+\.t|py)(?:#([a-zA-Z0-9_\-\.#]+))') | |
2790 tests = [] | 2791 tests = [] |
2791 for t in args: | 2792 for t in args: |
2792 case = [] | 2793 case = [] |
2793 | 2794 |
2794 if not (os.path.basename(t).startswith(b'test-') | 2795 if not (os.path.basename(t).startswith(b'test-') |
2795 and (t.endswith(b'.py') or t.endswith(b'.t'))): | 2796 and (t.endswith(b'.py') or t.endswith(b'.t'))): |
2796 | 2797 |
2797 m = testcasepattern.match(os.path.basename(t)) | 2798 m = testcasepattern.match(os.path.basename(t)) |
2798 if m is not None: | 2799 if m is not None: |
2799 t_basename, _, casestr = m.groups() | 2800 t_basename, casestr = m.groups() |
2800 t = os.path.join(os.path.dirname(t), t_basename) | 2801 t = os.path.join(os.path.dirname(t), t_basename) |
2801 if casestr: | 2802 if casestr: |
2802 case = casestr.split(b'#') | 2803 case = casestr.split(b'#') |
2803 else: | 2804 else: |
2804 continue | 2805 continue |