Patchwork [3,of,6,v3] tests: use $PYTHON in #! so we always use the right Python

login
register
mail settings
Submitter Augie Fackler
Date June 20, 2017, 2:10 p.m.
Message ID <395f5587885cfa3101c4.1497967838@augie-macbookpro2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/21529/
State Accepted
Headers show

Comments

Augie Fackler - June 20, 2017, 2:10 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1497551272 14400
#      Thu Jun 15 14:27:52 2017 -0400
# Node ID 395f5587885cfa3101c43dd76c4356e698aec472
# Parent  b2f59445c55490bee0bc421d731a375691a7bc8a
tests: use $PYTHON in #! so we always use the right Python
Yuya Nishihara - June 20, 2017, 3:27 p.m.
On Tue, 20 Jun 2017 10:10:38 -0400, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <augie@google.com>
> # Date 1497551272 14400
> #      Thu Jun 15 14:27:52 2017 -0400
> # Node ID 395f5587885cfa3101c43dd76c4356e698aec472
> # Parent  b2f59445c55490bee0bc421d731a375691a7bc8a
> tests: use $PYTHON in #! so we always use the right Python

Queued these, many thanks!

CC Matt Harbison: can you check if this works on MSYS?
Matt Harbison - June 21, 2017, 3:23 a.m.
On Tue, 20 Jun 2017 11:27:33 -0400, Yuya Nishihara <yuya@tcha.org> wrote:

> On Tue, 20 Jun 2017 10:10:38 -0400, Augie Fackler wrote:
>> # HG changeset patch
>> # User Augie Fackler <augie@google.com>
>> # Date 1497551272 14400
>> #      Thu Jun 15 14:27:52 2017 -0400
>> # Node ID 395f5587885cfa3101c43dd76c4356e698aec472
>> # Parent  b2f59445c55490bee0bc421d731a375691a7bc8a
>> tests: use $PYTHON in #! so we always use the right Python
>
> Queued these, many thanks!
>
> CC Matt Harbison: can you check if this works on MSYS?

test-import.t and test-bisect.t are sad, but it looks like it can be  
resolved by an extra layer of quoting.
Yuya Nishihara - June 21, 2017, 3:10 p.m.
On Tue, 20 Jun 2017 23:23:07 -0400, Matt Harbison wrote:
> On Tue, 20 Jun 2017 11:27:33 -0400, Yuya Nishihara <yuya@tcha.org> wrote:
> > On Tue, 20 Jun 2017 10:10:38 -0400, Augie Fackler wrote:
> >> # HG changeset patch
> >> # User Augie Fackler <augie@google.com>
> >> # Date 1497551272 14400
> >> #      Thu Jun 15 14:27:52 2017 -0400
> >> # Node ID 395f5587885cfa3101c43dd76c4356e698aec472
> >> # Parent  b2f59445c55490bee0bc421d731a375691a7bc8a
> >> tests: use $PYTHON in #! so we always use the right Python
> >
> > Queued these, many thanks!
> >
> > CC Matt Harbison: can you check if this works on MSYS?
> 
> test-import.t and test-bisect.t are sad, but it looks like it can be  
> resolved by an extra layer of quoting.

Thanks. I guessed they would all fail or all succeed. MSYS path mangling
rule wouldn't be simple.

Patch

diff --git a/tests/test-bisect.t b/tests/test-bisect.t
--- a/tests/test-bisect.t
+++ b/tests/test-bisect.t
@@ -453,7 +453,7 @@  assuming that the shell returns 127 if c
 test bisecting command
 
   $ cat > script.py <<EOF
-  > #!/usr/bin/env python
+  > #!$PYTHON
   > import sys
   > from mercurial import ui, hg
   > repo = hg.repository(ui.ui.load(), '.')
diff --git a/tests/test-extdiff.t b/tests/test-extdiff.t
--- a/tests/test-extdiff.t
+++ b/tests/test-extdiff.t
@@ -249,7 +249,7 @@  Edit with extdiff -p:
 Prepare custom diff/edit tool:
 
   $ cat > 'diff tool.py' << EOT
-  > #!/usr/bin/env python
+  > #!$PYTHON
   > import time
   > time.sleep(1) # avoid unchanged-timestamp problems
   > file('a/a', 'ab').write('edited\n')
diff --git a/tests/test-extension.t b/tests/test-extension.t
--- a/tests/test-extension.t
+++ b/tests/test-extension.t
@@ -98,7 +98,7 @@  Command with no output, we just want to 
 Check hgweb's load order:
 
   $ cat > hgweb.cgi <<EOF
-  > #!/usr/bin/env python
+  > #!$PYTHON
   > from mercurial import demandimport; demandimport.enable()
   > from mercurial.hgweb import hgweb
   > from mercurial.hgweb import wsgicgi
diff --git a/tests/test-highlight.t b/tests/test-highlight.t
--- a/tests/test-highlight.t
+++ b/tests/test-highlight.t
@@ -956,7 +956,7 @@  We attempt to highlight unknown files by
   > EOF
 
   $ cat > unknownfile << EOF
-  > #!/usr/bin/python
+  > #!$PYTHON
   > def foo():
   >    pass
   > EOF
diff --git a/tests/test-largefiles-cache.t b/tests/test-largefiles-cache.t
--- a/tests/test-largefiles-cache.t
+++ b/tests/test-largefiles-cache.t
@@ -93,7 +93,7 @@  Verify that largefiles from pulled branc
 Portable way to print file permissions:
 
   $ cat > ls-l.py <<EOF
-  > #!/usr/bin/env python
+  > #!$PYTHON
   > import sys, os
   > path = sys.argv[1]
   > print '%03o' % (os.lstat(path).st_mode & 0777)
diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t
--- a/tests/test-largefiles.t
+++ b/tests/test-largefiles.t
@@ -215,7 +215,7 @@  Test display of largefiles in hgweb
 Test largefiles can be loaded in hgweb (wrapcommand() shouldn't fail)
 
   $ cat <<EOF > "$TESTTMP/hgweb.cgi"
-  > #!/usr/bin/env python
+  > #!$PYTHON
   > from mercurial import demandimport; demandimport.enable()
   > from mercurial.hgweb import hgweb
   > from mercurial.hgweb import wsgicgi
diff --git a/tests/test-merge-symlinks.t b/tests/test-merge-symlinks.t
--- a/tests/test-merge-symlinks.t
+++ b/tests/test-merge-symlinks.t
@@ -1,5 +1,5 @@ 
   $ cat > echo.py <<EOF
-  > #!/usr/bin/env python
+  > #!$PYTHON
   > import os, sys
   > try:
   >     import msvcrt
diff --git a/tests/test-newcgi.t b/tests/test-newcgi.t
--- a/tests/test-newcgi.t
+++ b/tests/test-newcgi.t
@@ -5,7 +5,7 @@  before d74fc8dec2b4 still work.
 
   $ hg init test
   $ cat >hgweb.cgi <<HGWEB
-  > #!/usr/bin/env python
+  > #!$PYTHON
   > #
   > # An example CGI script to use hgweb, edit as necessary
   > 
@@ -31,7 +31,7 @@  before d74fc8dec2b4 still work.
   > HGWEBDIRCONF
 
   $ cat >hgwebdir.cgi <<HGWEBDIR
-  > #!/usr/bin/env python
+  > #!$PYTHON
   > #
   > # An example CGI script to export multiple hgweb repos, edit as necessary
   > 
diff --git a/tests/test-newercgi.t b/tests/test-newercgi.t
--- a/tests/test-newercgi.t
+++ b/tests/test-newercgi.t
@@ -5,7 +5,7 @@  This is a rudimentary test of the CGI fi
   $ hg init test
 
   $ cat >hgweb.cgi <<HGWEB
-  > #!/usr/bin/env python
+  > #!$PYTHON
   > #
   > # An example CGI script to use hgweb, edit as necessary
   > 
@@ -28,7 +28,7 @@  This is a rudimentary test of the CGI fi
   > HGWEBDIRCONF
 
   $ cat >hgwebdir.cgi <<HGWEBDIR
-  > #!/usr/bin/env python
+  > #!$PYTHON
   > #
   > # An example CGI script to export multiple hgweb repos, edit as necessary
   > 
diff --git a/tests/test-oldcgi.t b/tests/test-oldcgi.t
--- a/tests/test-oldcgi.t
+++ b/tests/test-oldcgi.t
@@ -4,7 +4,7 @@  This tests if CGI files from before d0db
 
   $ hg init test
   $ cat >hgweb.cgi <<HGWEB
-  > #!/usr/bin/env python
+  > #!$PYTHON
   > #
   > # An example CGI script to use hgweb, edit as necessary
   > 
@@ -26,7 +26,7 @@  This tests if CGI files from before d0db
   > HGWEBDIRCONF
 
   $ cat >hgwebdir.cgi <<HGWEBDIR
-  > #!/usr/bin/env python
+  > #!$PYTHON
   > #
   > # An example CGI script to export multiple hgweb repos, edit as necessary
   >