testrunner: avoid capturing a regex group we don't care about
authorMartin von Zweigbergk <martinvonz@google.com>
Tue, 08 Jan 2019 22:07:47 -0800
changeset 41142 89d103fc9c19
parent 41141 92a5fb73b3d5
child 41143 8cf92ca92bfe
testrunner: avoid capturing a regex group we don't care about Differential Revision: https://phab.mercurial-scm.org/D5536
tests/run-tests.py
--- a/tests/run-tests.py	Tue Jan 08 14:48:05 2019 -0800
+++ b/tests/run-tests.py	Tue Jan 08 22:07:47 2019 -0800
@@ -2786,7 +2786,8 @@
                 expanded_args.append(arg)
         args = expanded_args
 
-        testcasepattern = re.compile(br'([\w-]+\.t|py)(#([a-zA-Z0-9_\-\.#]+))')
+        testcasepattern = re.compile(
+            br'([\w-]+\.t|py)(?:#([a-zA-Z0-9_\-\.#]+))')
         tests = []
         for t in args:
             case = []
@@ -2796,7 +2797,7 @@
 
                 m = testcasepattern.match(os.path.basename(t))
                 if m is not None:
-                    t_basename, _, casestr = m.groups()
+                    t_basename, casestr = m.groups()
                     t = os.path.join(os.path.dirname(t), t_basename)
                     if casestr:
                         case = casestr.split(b'#')