Mercurial > public > mercurial-scm > hg
diff tests/run-tests.py @ 38222:507bdc40bb17
run-tests: add support for running specific test cases
Differential Revision: https://phab.mercurial-scm.org/D3555
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Thu, 26 Apr 2018 23:57:20 +0200 |
parents | 700aaa19de63 |
children | b865bba56db1 |
line wrap: on
line diff
--- a/tests/run-tests.py Sun Jun 03 17:02:38 2018 +0530 +++ b/tests/run-tests.py Thu Apr 26 23:57:20 2018 +0200 @@ -2646,16 +2646,31 @@ expanded_args.append(arg) args = expanded_args + testcasepattern = re.compile(r'([\w-]+\.t|py)( \(case ([\w-])+\))') tests = [] for t in args: + case = None + if not (os.path.basename(t).startswith(b'test-') and (t.endswith(b'.py') or t.endswith(b'.t'))): - continue + + m = testcasepattern.match(t) + if m is not None: + t, _, case = m.groups() + else: + continue + if t.endswith(b'.t'): # .t file may contain multiple test cases cases = sorted(parsettestcases(t)) if cases: - tests += [{'path': t, 'case': c} for c in sorted(cases)] + if case is not None and case in cases: + tests += [{'path': t, 'case': case}] + elif case is not None and case not in cases: + # Ignore invalid cases + pass + else: + tests += [{'path': t, 'case': c} for c in sorted(cases)] else: tests.append({'path': t}) else: