D5535: tests: support passing testcase after .t paths that have path separators

spectral (Kyle Lippincott) phabricator at mercurial-scm.org
Wed Jan 9 02:49:36 UTC 2019


spectral created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This probably could have been implemented by changing the regex above this bit
  of code, but I wasn't sure if it would end up handling various OSes correctly,
  so I decided to go with this version instead.
  
  Previously:
  
    $ tests/run-tests.py tests/test-ssh.t -l
    running 2 tests using 2 parallel processes
    ..
    # Ran 2 tests, 0 skipped, 0 failed.
    
    $ tests/run-tests.py tests/test-ssh.t#sshv1 -l
    running 0 tests using 0 parallel processes
    
    # Ran 0 tests, 0 skipped, 0 failed.
  
  Now:
  
    $ tests/run-tests.py tests/test-ssh.t -l
    running 2 tests using 2 parallel processes
    ..
    # Ran 2 tests, 0 skipped, 0 failed.
    
    $ tests/run-tests.py tests/test-ssh.t#sshv1 -l
    running 1 tests using 1 parallel processes
    .
    # Ran 1 tests, 0 skipped, 0 failed.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/run-tests.py

CHANGE DETAILS

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -2794,9 +2794,10 @@
             if not (os.path.basename(t).startswith(b'test-')
                     and (t.endswith(b'.py') or t.endswith(b'.t'))):
 
-                m = testcasepattern.match(t)
+                m = testcasepattern.match(os.path.basename(t))
                 if m is not None:
-                    t, _, casestr = m.groups()
+                    t_basename, _, casestr = m.groups()
+                    t = os.path.join(os.path.dirname(t), t_basename)
                     if casestr:
                         case = casestr.split(b'#')
                 else:



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


More information about the Mercurial-devel mailing list