Patchwork D5536: testrunner: avoid capturing a regex group we don't care about

login
register
mail settings
Submitter phabricator
Date Jan. 9, 2019, 2:08 p.m.
Message ID <fcafe6306236322ec9d63f739bccfd40@localhost.localdomain>
Download mbox | patch
Permalink /patch/37575/
State Not Applicable
Headers show

Comments

phabricator - Jan. 9, 2019, 2:08 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG89d103fc9c19: testrunner: avoid capturing a regex group we don&#039;t care about (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5536?vs=13089&id=13094

REVISION DETAIL
  https://phab.mercurial-scm.org/D5536

AFFECTED FILES
  tests/run-tests.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -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'#')