Patchwork [2,of,3,py3,v3] tests: make a variable for hg binary location in test-check-py3-commands

login
register
mail settings
Submitter Augie Fackler
Date March 12, 2017, 10:42 p.m.
Message ID <2cd4d7ea0b19c4d5c55c.1489358545@augie-macbookair2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/19256/
State Accepted
Headers show

Comments

Augie Fackler - March 12, 2017, 10:42 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1489304265 14400
#      Sun Mar 12 03:37:45 2017 -0400
# Node ID 2cd4d7ea0b19c4d5c55ccf8026ff1d7aa493a8cb
# Parent  a8f3bbc6259aebdeeef9f58309800f4070081214
tests: make a variable for hg binary location in test-check-py3-commands

The number of which calls in here is starting to get silly.
Gregory Szorc - March 13, 2017, 8:30 p.m.
On Sun, Mar 12, 2017 at 3:42 PM, Augie Fackler <raf@durin42.com> wrote:

> # HG changeset patch
> # User Augie Fackler <augie@google.com>
> # Date 1489304265 14400
> #      Sun Mar 12 03:37:45 2017 -0400
> # Node ID 2cd4d7ea0b19c4d5c55ccf8026ff1d7aa493a8cb
> # Parent  a8f3bbc6259aebdeeef9f58309800f4070081214
> tests: make a variable for hg binary location in test-check-py3-commands
>
> The number of which calls in here is starting to get silly.
>

This is strictly better. But we may want to just introduce a $PY3HG
environment variable from run-tests.py. As long as it isn't quoted, shell
expansion should "just work." Or if shell expansion is a problem, we can
install a py3hg wrapper script that sets python3 in the shebang and alias
that to $PY3HG or something.


>
> diff --git a/tests/test-check-py3-commands.t b/tests/test-check-py3-
> commands.t
> --- a/tests/test-check-py3-commands.t
> +++ b/tests/test-check-py3-commands.t
> @@ -3,10 +3,11 @@
>  This test helps in keeping a track on which commands we can run on
>  Python 3 and see what kind of errors are coming up.
>  The full traceback is hidden to have a stable output.
> +  $ HGBIN=`which hg`
>
>    $ for cmd in version debuginstall ; do
>    >   echo $cmd
> -  >   $PYTHON3 `which hg` $cmd 2>&1 2>&1 | tail -1
> +  >   $PYTHON3 $HGBIN $cmd 2>&1 2>&1 | tail -1
>    > done
>    version
>    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
> PURPOSE.
> @@ -20,7 +21,7 @@ The full traceback is hidden to have a s
>    $ cat >> $HGRCPATH <<EOF
>    > %include $TESTTMP/included-hgrc
>    > EOF
> -  $ $PYTHON3 `which hg` version | tail -1
> +  $ $PYTHON3 $HGBIN version | tail -1
>    *** failed to import extension babar from imaginary_elephant: *:
> 'imaginary_elephant' (glob)
>    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
> PURPOSE.
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
Augie Fackler - March 13, 2017, 8:32 p.m.
> On Mar 13, 2017, at 13:30, Gregory Szorc <gregory.szorc@gmail.com> wrote:
> 
> On Sun, Mar 12, 2017 at 3:42 PM, Augie Fackler <raf@durin42.com> wrote:
> # HG changeset patch
> # User Augie Fackler <augie@google.com>
> # Date 1489304265 14400
> #      Sun Mar 12 03:37:45 2017 -0400
> # Node ID 2cd4d7ea0b19c4d5c55ccf8026ff1d7aa493a8cb
> # Parent  a8f3bbc6259aebdeeef9f58309800f4070081214
> tests: make a variable for hg binary location in test-check-py3-commands
> 
> The number of which calls in here is starting to get silly.
> 
> This is strictly better. But we may want to just introduce a $PY3HG environment variable from run-tests.py. As long as it isn't quoted, shell expansion should "just work." Or if shell expansion is a problem, we can install a py3hg wrapper script that sets python3 in the shebang and alias that to $PY3HG or something.

I'm hoping we can get a whole .t file that passes in Python 3 soon, and this can be obsoleted by a buildbot target that does python3  run-tests.py with a python3 hg.

Patch

diff --git a/tests/test-check-py3-commands.t b/tests/test-check-py3-commands.t
--- a/tests/test-check-py3-commands.t
+++ b/tests/test-check-py3-commands.t
@@ -3,10 +3,11 @@ 
 This test helps in keeping a track on which commands we can run on
 Python 3 and see what kind of errors are coming up.
 The full traceback is hidden to have a stable output.
+  $ HGBIN=`which hg`
 
   $ for cmd in version debuginstall ; do
   >   echo $cmd
-  >   $PYTHON3 `which hg` $cmd 2>&1 2>&1 | tail -1
+  >   $PYTHON3 $HGBIN $cmd 2>&1 2>&1 | tail -1
   > done
   version
   warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
@@ -20,7 +21,7 @@  The full traceback is hidden to have a s
   $ cat >> $HGRCPATH <<EOF
   > %include $TESTTMP/included-hgrc
   > EOF
-  $ $PYTHON3 `which hg` version | tail -1
+  $ $PYTHON3 $HGBIN version | tail -1
   *** failed to import extension babar from imaginary_elephant: *: 'imaginary_elephant' (glob)
   warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.