[PATCH 4 of 4] run-tests: print more information on unnecessary glob matching

Augie Fackler raf at durin42.com
Thu Jan 16 08:40:25 CST 2014


On Thu, Jan 16, 2014 at 12:33:31PM +0100, Simon Heimberg wrote:
> # HG changeset patch
> # User Simon Heimberg <simohe at besonet.ch>
> # Date 1389870537 -3600
> #      Thu Jan 16 12:08:57 2014 +0100
> # Node ID 78c29cfaab7b8d5106244af0f52ba2d2e09a8a89
> # Parent  0b0198d3b9361f4734e24256dd13255b5aec7b44
> run-tests: print more information on unnecessary glob matching

Overall, I very much like the series. Clean up the weird doctest
indentation in patch 1?

>
> Extend the message with the test name and the approximate line number. (The
> line number is the one of the command producing the output.)
> Finding the line to fix is easier now.
>
> old message:
> ......
> Info, unnecessary glob: at a/b/c (glob)
> ..
>
> new message:
> ......
> Info, unnecessary glob in test-example.t (after line 9): at a/b/c (glob)
> ..
>
>
> The test result is still pass as before.
>
> diff -r 0b0198d3b936 -r 78c29cfaab7b tests/run-tests.py
> --- a/tests/run-tests.py	Thu Jan 16 12:08:29 2014 +0100
> +++ b/tests/run-tests.py	Thu Jan 16 12:08:57 2014 +0100
> @@ -606,7 +606,7 @@
>      if el + '\n' == l:
>          if os.altsep:
>              # matching on "/" is not needed for this line
> -            log("\nInfo, unnecessary glob: %s (glob)" % el)
> +            return '-glob'
>          return True
>      i, n = 0, len(el)
>      res = ''
> @@ -797,7 +797,14 @@
>              if isinstance(r, str):
>                  if r == '+glob':
>                      lout = el[:-1] + ' (glob)\n'
> -                r = False
> +                    r = False
> +                elif r == '-glob':
> +                    log('\ninfo, unnecessary glob in %s (after line %d):'
> +                        ' %s (glob)\n' % (test, pos, el[-1]))
> +                    r = True # pass on unnecessary glob
> +                else:
> +                    log('\ninfo, unknown linematch result: %r\n' % r)
> +                    r = False
>              if r:
>                  postout.append("  " + el)
>              else:
> diff -r 0b0198d3b936 -r 78c29cfaab7b tests/test-run-tests.py
> --- a/tests/test-run-tests.py	Thu Jan 16 12:08:29 2014 +0100
> +++ b/tests/test-run-tests.py	Thu Jan 16 12:08:57 2014 +0100
> @@ -44,9 +44,7 @@
>
>      direct matching, glob unnecessary
>          >>> lm('g/b (glob)\n', 'g/b\n')
> -        <BLANKLINE>
> -        Info, unnecessary glob: g/b (glob)
> -        True
> +        'special: -glob'
>
>      missing glob
>          >>> lm('/g/c/d/fg\n', '\\g\\c\\d/fg\n')
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list