Patchwork hook: filter out unstable output in tests

login
register
mail settings
Submitter Siddharth Agarwal
Date March 10, 2016, 12:17 a.m.
Message ID <f131963e13d6fec5d51c.1457569062@dev666.prn1.facebook.com>
Download mbox | patch
Permalink /patch/13732/
State Superseded
Commit 12fdf49fa4dddb361609520f541b1b420dc8d36a
Delegated to: Yuya Nishihara
Headers show

Comments

Siddharth Agarwal - March 10, 2016, 12:17 a.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1457568912 28800
#      Wed Mar 09 16:15:12 2016 -0800
# Node ID f131963e13d6fec5d51cafd479d530c814f61cd3
# Parent  1c658391b22fb4d98ccfb60c0e57315b55634117
# Available At http://42.netv6.net/sid0-wip/hg/
#              hg pull http://42.netv6.net/sid0-wip/hg/ -r f131963e13d6
hook: filter out unstable output in tests

This output is different between Python 2.6 and Python 2.7. It's also pretty
irrelevant, so just filter it out.
Jun Wu - March 10, 2016, 3:44 p.m.
On 03/10/2016 12:17 AM, Siddharth Agarwal wrote:
> # HG changeset patch
> # User Siddharth Agarwal<sid0@fb.com>
> # Date 1457568912 28800
> #      Wed Mar 09 16:15:12 2016 -0800
> # Node ID f131963e13d6fec5d51cafd479d530c814f61cd3
> # Parent  1c658391b22fb4d98ccfb60c0e57315b55634117

This Python 2.6 space issue has been bugging me for a long time and finally
we have a fix! Looks good to me.
Pierre-Yves David - March 10, 2016, 3:48 p.m.
On 03/10/2016 12:17 AM, Siddharth Agarwal wrote:
> # HG changeset patch
> # User Siddharth Agarwal <sid0@fb.com>
> # Date 1457568912 28800
> #      Wed Mar 09 16:15:12 2016 -0800
> # Node ID f131963e13d6fec5d51cafd479d530c814f61cd3
> # Parent  1c658391b22fb4d98ccfb60c0e57315b55634117
> # Available At http://42.netv6.net/sid0-wip/hg/
> #              hg pull http://42.netv6.net/sid0-wip/hg/ -r f131963e13d6
> hook: filter out unstable output in tests
>
> This output is different between Python 2.6 and Python 2.7. It's also pretty
> irrelevant, so just filter it out.
>
> diff --git a/tests/test-hook.t b/tests/test-hook.t
> --- a/tests/test-hook.t
> +++ b/tests/test-hook.t
> @@ -530,13 +530,11 @@ test python hooks
>     (run with --traceback for stack trace)
>     [255]
>
> -  $ hg pull ../a --traceback 2>&1 | egrep -v '^( +File|    [_a-zA-Z*(])'
> +  $ hg pull ../a --traceback 2>&1 | egrep -v '^( +File|    [_a-zA-Z*(])' | egrep -v '^( )+(\^)?$'
>     pulling from ../a
>     searching for changes
>     exception from first failed import attempt:
>     Traceback (most recent call last):
> -
> -      ^
>     SyntaxError: invalid syntax
>     exception from second failed import attempt:
>     Traceback (most recent call last):

Filtering it out without a comment feels strange to me. Can we use 
(glob) on it instead? And document the trick?
Siddharth Agarwal - March 10, 2016, 5:38 p.m.
On 3/10/16 07:48, Pierre-Yves David wrote:
> Filtering it out without a comment feels strange to me. Can we use 
> (glob) on it instead? And document the trick? 

I can document it, but I'd prefer not printing out the output at all. 
The only relevant line here is the SyntaxError line.
Pierre-Yves David - March 10, 2016, 5:40 p.m.
On 03/10/2016 05:38 PM, Siddharth Agarwal wrote:
> On 3/10/16 07:48, Pierre-Yves David wrote:
>> Filtering it out without a comment feels strange to me. Can we use
>> (glob) on it instead? And document the trick?
>
> I can document it, but I'd prefer not printing out the output at all.
> The only relevant line here is the SyntaxError line.

But isn't that line part of the SyntaxError report ?
Siddharth Agarwal - March 10, 2016, 5:41 p.m.
On 3/10/16 09:40, Pierre-Yves David wrote:
> But isn't that line part of the SyntaxError report ? 

Yes, but what the syntax error is is irrelevant -- the test will work no 
matter what it is. The only relevant information here is that it is a 
syntax error.
timeless - March 10, 2016, 5:44 p.m.
Then why not grep SyntaxError?
On Mar 10, 2016 12:42 PM, "Siddharth Agarwal" <sid@less-broken.com> wrote:

> On 3/10/16 09:40, Pierre-Yves David wrote:
>
>> But isn't that line part of the SyntaxError report ?
>>
>
> Yes, but what the syntax error is is irrelevant -- the test will work no
> matter what it is. The only relevant information here is that it is a
> syntax error.
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
Siddharth Agarwal - March 10, 2016, 6:11 p.m.
On 3/10/16 09:44, timeless wrote:
>
> Then why not grep SyntaxError?
>

Because there are a number of other lines in the output from the same 
command that are useful. For the syntax error *specifically*, only the 
fact that it is a syntax error is useful. In fact the first egrep 
filters out the actual traceback. Those lines just didn't get filtered 
out properly.


> On Mar 10, 2016 12:42 PM, "Siddharth Agarwal" <sid@less-broken.com 
> <mailto:sid@less-broken.com>> wrote:
>
>     On 3/10/16 09:40, Pierre-Yves David wrote:
>
>         But isn't that line part of the SyntaxError report ?
>
>
>     Yes, but what the syntax error is is irrelevant -- the test will
>     work no matter what it is. The only relevant information here is
>     that it is a syntax error.
>     _______________________________________________
>     Mercurial-devel mailing list
>     Mercurial-devel@mercurial-scm.org
>     <mailto:Mercurial-devel@mercurial-scm.org>
>     https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>

Patch

diff --git a/tests/test-hook.t b/tests/test-hook.t
--- a/tests/test-hook.t
+++ b/tests/test-hook.t
@@ -530,13 +530,11 @@  test python hooks
   (run with --traceback for stack trace)
   [255]
 
-  $ hg pull ../a --traceback 2>&1 | egrep -v '^( +File|    [_a-zA-Z*(])'
+  $ hg pull ../a --traceback 2>&1 | egrep -v '^( +File|    [_a-zA-Z*(])' | egrep -v '^( )+(\^)?$'
   pulling from ../a
   searching for changes
   exception from first failed import attempt:
   Traceback (most recent call last):
-      
-      ^
   SyntaxError: invalid syntax
   exception from second failed import attempt:
   Traceback (most recent call last):