comparison tests/run-tests.py @ 38223:b865bba56db1

run-tests: update the test case name format 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. Differential Revision: https://phab.mercurial-scm.org/D3556
author Boris Feld <boris.feld@octobus.net>
date Sun, 13 May 2018 23:18:26 +0200
parents 507bdc40bb17
children f2e3196a34f9
comparison
equal deleted inserted replaced
38222:507bdc40bb17 38223:b865bba56db1
118 failed: '#7f0000', 118 failed: '#7f0000',
119 failedname: '#ff0000', 119 failedname: '#ff0000',
120 } 120 }
121 121
122 class TestRunnerLexer(lexer.RegexLexer): 122 class TestRunnerLexer(lexer.RegexLexer):
123 testpattern = r'[\w-]+\.(t|py)( \(case [\w-]+\))?' 123 testpattern = r'[\w-]+\.(t|py)(#[\w-]+)?'
124 tokens = { 124 tokens = {
125 'root': [ 125 'root': [
126 (r'^Skipped', token.Generic.Skipped, 'skipped'), 126 (r'^Skipped', token.Generic.Skipped, 'skipped'),
127 (r'^Failed ', token.Generic.Failed, 'failed'), 127 (r'^Failed ', token.Generic.Failed, 'failed'),
128 (r'^ERROR: ', token.Generic.Failed, 'failed'), 128 (r'^ERROR: ', token.Generic.Failed, 'failed'),
1245 case = kwds.pop('case', None) 1245 case = kwds.pop('case', None)
1246 self._case = case 1246 self._case = case
1247 self._allcases = parsettestcases(path) 1247 self._allcases = parsettestcases(path)
1248 super(TTest, self).__init__(path, *args, **kwds) 1248 super(TTest, self).__init__(path, *args, **kwds)
1249 if case: 1249 if case:
1250 self.name = '%s (case %s)' % (self.name, _strpath(case)) 1250 self.name = '%s#%s' % (self.name, _strpath(case))
1251 self.errpath = b'%s.%s.err' % (self.errpath[:-4], case) 1251 self.errpath = b'%s.%s.err' % (self.errpath[:-4], case)
1252 self._tmpname += b'-%s' % case 1252 self._tmpname += b'-%s' % case
1253 self._have = {} 1253 self._have = {}
1254 1254
1255 @property 1255 @property
2644 expanded_args.extend([arg + a for a in os.listdir(arg)]) 2644 expanded_args.extend([arg + a for a in os.listdir(arg)])
2645 else: 2645 else:
2646 expanded_args.append(arg) 2646 expanded_args.append(arg)
2647 args = expanded_args 2647 args = expanded_args
2648 2648
2649 testcasepattern = re.compile(r'([\w-]+\.t|py)( \(case ([\w-])+\))') 2649 testcasepattern = re.compile(r'([\w-]+\.t|py)(#([\w-])+)')
2650 tests = [] 2650 tests = []
2651 for t in args: 2651 for t in args:
2652 case = None 2652 case = None
2653 2653
2654 if not (os.path.basename(t).startswith(b'test-') 2654 if not (os.path.basename(t).startswith(b'test-')