Patchwork D3556: run-tests: update the test case name format

login
register
mail settings
Submitter phabricator
Date May 13, 2018, 9:28 p.m.
Message ID <differential-rev-PHID-DREV-tycbqiy4eea6idu2go5d-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/31578/
State New
Headers show

Comments

phabricator - May 13, 2018, 9:28 p.m.
lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Manually typing parenthesis and spaces will be tedious when trying to launch a
  specific test case.
  
  I'm proposing a simpler format that is less hard to remember and type right.
  There was other possibilities envisaged like `::` or `!`, I think `#` is
  slight easier to type but I'm open to any suggestion on the new format.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/run-tests.py
  tests/test-run-tests.t

CHANGE DETAILS




To: lothiraldan, #hg-reviewers
Cc: mercurial-devel
phabricator - May 14, 2018, 11:24 p.m.
quark accepted this revision.
quark added a comment.


  I like this change. Didn't realize it's this simple. Marking as accetped.

REPOSITORY
  rHG Mercurial

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

To: lothiraldan, #hg-reviewers, quark
Cc: quark, mercurial-devel
phabricator - May 17, 2018, 6:43 p.m.
pulkit added a comment.


  Getting this test failure at the tip of hg-committed with this series applied, can you have a look?
  
    --- /home/foobar/repo/pushaccess/tests/test-run-tests.t
    +++ /home/foobar/repo/pushaccess/tests/test-run-tests.t.err
    @@ -1634,9 +1634,24 @@
        #endif
       
       ERROR: test-cases-abc.t#B output changed
    -  !
    +  !.
    +  --- $TESTTMP/anothertests/cases/test-cases-abc.t
    +  +++ $TESTTMP/anothertests/cases/test-cases-abc.t.B.err
    +  @@ -7,7 +7,7 @@
    +     $ V=C
    +   #endif
    +     $ echo $V | sed 's/A/C/'
    +  -  C
    +  +  B
    +   #if C
    +     $ [ $V = C ]
    +   #endif
    +  
    +  ERROR: test-cases-abc.t#B output changed
    +  !.
       Failed test-cases-abc.t#B: output changed
    -  # Ran 1 tests, 0 skipped, 1 failed.
    +  Failed test-cases-abc.t#B: output changed
    +  # Ran 4 tests, 0 skipped, 2 failed.
       python hash seed: * (glob)
       [1]
     
    
    ERROR: test-run-tests.t output changed

REPOSITORY
  rHG Mercurial

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

To: lothiraldan, #hg-reviewers, quark, pulkit
Cc: quark, mercurial-devel

Patch

diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t
--- a/tests/test-run-tests.t
+++ b/tests/test-run-tests.t
@@ -1496,9 +1496,9 @@ 
      $ [ $V = C ]
    #endif
   
-  ERROR: test-cases-abc.t (case B) output changed
+  ERROR: test-cases-abc.t#B output changed
   !.
-  Failed test-cases-abc.t (case B): output changed
+  Failed test-cases-abc.t#B: output changed
   # Ran 3 tests, 0 skipped, 1 failed.
   python hash seed: * (glob)
   [1]
@@ -1519,9 +1519,9 @@ 
      $ [ $V = C ]
    #endif
   
-  ERROR: test-cases-abc.t (case B) output changed
+  ERROR: test-cases-abc.t#B output changed
   !.
-  Failed test-cases-abc.t (case B): output changed
+  Failed test-cases-abc.t#B: output changed
   # Ran 2 tests, 0 skipped, 1 failed.
   python hash seed: * (glob)
   [1]
@@ -1544,9 +1544,9 @@ 
      $ [ $V = C ]
    #endif
   
-  ERROR: test-cases-abc.t (case B) output changed
+  ERROR: test-cases-abc.t#B output changed
   !.
-  Failed test-cases-abc.t (case B): output changed
+  Failed test-cases-abc.t#B: output changed
   # Ran 2 tests, 0 skipped, 1 failed.
   python hash seed: * (glob)
   [1]
@@ -1573,7 +1573,7 @@ 
 
 Support running a specific test case
 
-  $ rt "test-cases-abc.t (case B)"
+  $ rt "test-cases-abc.t#B"
   
   --- $TESTTMP/anothertests/cases/test-cases-abc.t
   +++ $TESTTMP/anothertests/cases/test-cases-abc.t.B.err
@@ -1587,16 +1587,16 @@ 
      $ [ $V = C ]
    #endif
   
-  ERROR: test-cases-abc.t (case B) output changed
+  ERROR: test-cases-abc.t#B output changed
   !
-  Failed test-cases-abc.t (case B): output changed
+  Failed test-cases-abc.t#B: output changed
   # Ran 1 tests, 0 skipped, 1 failed.
   python hash seed: * (glob)
   [1]
 
 Support running multiple test cases in the same file
 
-  $ rt "test-cases-abc.t (case B)" "test-cases-abc.t (case C)"
+  $ rt test-cases-abc.t#B test-cases-abc.t#C
   
   --- $TESTTMP/anothertests/cases/test-cases-abc.t
   +++ $TESTTMP/anothertests/cases/test-cases-abc.t.B.err
@@ -1610,16 +1610,16 @@ 
      $ [ $V = C ]
    #endif
   
-  ERROR: test-cases-abc.t (case B) output changed
+  ERROR: test-cases-abc.t#B output changed
   !.
-  Failed test-cases-abc.t (case B): output changed
+  Failed test-cases-abc.t#B: output changed
   # Ran 2 tests, 0 skipped, 1 failed.
   python hash seed: * (glob)
   [1]
 
 Support running invalid test cases
 
-  $ rt "test-cases-abc.t (case B)" "test-cases-abc.t (case D)"
+  $ rt test-cases-abc.t#B test-cases-abc.t#D
   
   --- $TESTTMP/anothertests/cases/test-cases-abc.t
   +++ $TESTTMP/anothertests/cases/test-cases-abc.t.B.err
@@ -1633,9 +1633,9 @@ 
      $ [ $V = C ]
    #endif
   
-  ERROR: test-cases-abc.t (case B) output changed
+  ERROR: test-cases-abc.t#B output changed
   !
-  Failed test-cases-abc.t (case B): output changed
+  Failed test-cases-abc.t#B: output changed
   # Ran 1 tests, 0 skipped, 1 failed.
   python hash seed: * (glob)
   [1]
diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -120,7 +120,7 @@ 
         }
 
     class TestRunnerLexer(lexer.RegexLexer):
-        testpattern = r'[\w-]+\.(t|py)( \(case [\w-]+\))?'
+        testpattern = r'[\w-]+\.(t|py)(#[\w-]+)?'
         tokens = {
             'root': [
                 (r'^Skipped', token.Generic.Skipped, 'skipped'),
@@ -1247,7 +1247,7 @@ 
         self._allcases = parsettestcases(path)
         super(TTest, self).__init__(path, *args, **kwds)
         if case:
-            self.name = '%s (case %s)' % (self.name, _strpath(case))
+            self.name = '%s#%s' % (self.name, _strpath(case))
             self.errpath = b'%s.%s.err' % (self.errpath[:-4], case)
             self._tmpname += b'-%s' % case
         self._have = {}
@@ -2646,7 +2646,7 @@ 
                 expanded_args.append(arg)
         args = expanded_args
 
-        testcasepattern = re.compile(r'([\w-]+\.t|py)( \(case ([\w-])+\))')
+        testcasepattern = re.compile(r'([\w-]+\.t|py)(#([\w-])+)')
         tests = []
         for t in args:
             case = None