tests: replace yet more calls to `python` with $PYTHON
authorAugie Fackler <augie@google.com>
Wed, 05 Jul 2017 11:10:11 -0500
changeset 38620 8e6f4939a69ae8949e134d97de6b766799bca8de
parent 38619 be49f3fdcd10d63dc44553d9a1d91b2067df106c
child 38621 ed61189763ef7343659d7dc27add64c7e2c8b19e
push id543
push usergszorc@mozilla.com
push dateFri, 07 Jul 2017 01:21:09 +0000
tests: replace yet more calls to `python` with $PYTHON These are some simple cases. More to come in a future change. Reviewers: krbullock Reviewed By: krbullock Differential Revision: https://phab.mercurial-scm.org/D4
tests/test-bundle2-pushback.t
tests/test-check-module-imports.t
tests/test-clone-cgi.t
tests/test-command-template.t
tests/test-commit-interactive-curses.t
tests/test-conflict.t
tests/test-contrib.t
tests/test-encoding-align.t
tests/test-encoding.t
tests/test-extension.t
tests/test-help.t
tests/test-hgweb-commands.t
tests/test-histedit-arguments.t
tests/test-imports-checker.t
tests/test-largefiles.t
tests/test-log.t
tests/test-mq.t
tests/test-newcgi.t
tests/test-newercgi.t
tests/test-oldcgi.t
tests/test-parseindex.t
tests/test-purge.t
tests/test-push-cgi.t
tests/test-push-race.t
tests/test-revset.t
tests/test-ssh-bundle1.t
tests/test-ssh.t
tests/test-tag.t
--- a/tests/test-bundle2-pushback.t
+++ b/tests/test-bundle2-pushback.t
@@ -20,17 +20,17 @@
   >         op.reply.newpart('output', data='pushback not enabled')
   >     return result
   > _newhandlechangegroup.params = bundle2.handlechangegroup.params
   > bundle2.parthandlermapping['changegroup'] = _newhandlechangegroup
   > EOF
 
   $ cat >> $HGRCPATH <<EOF
   > [ui]
-  > ssh = python "$TESTDIR/dummyssh"
+  > ssh = $PYTHON "$TESTDIR/dummyssh"
   > username = nobody <no.reply@example.com>
   > 
   > [alias]
   > tglog = log -G -T "{desc} [{phase}:{node|short}]"
   > EOF
 
 Set up server repository
 
--- a/tests/test-check-module-imports.t
+++ b/tests/test-check-module-imports.t
@@ -32,9 +32,9 @@ outputs, which should be fixed later.
   > -X tests/test-imports-checker.t \
   > -X tests/test-commit-interactive.t \
   > -X tests/test-contrib-check-code.t \
   > -X tests/test-extension.t \
   > -X tests/test-hghave.t \
   > -X tests/test-hgweb-no-path-info.t \
   > -X tests/test-hgweb-no-request-uri.t \
   > -X tests/test-hgweb-non-interactive.t \
-  > | sed 's-\\-/-g' | python "$import_checker" -
+  > | sed 's-\\-/-g' | $PYTHON "$import_checker" -
--- a/tests/test-clone-cgi.t
+++ b/tests/test-clone-cgi.t
@@ -21,19 +21,19 @@ initialize repository
   > wsgicgi.launch(application)
   > HGWEB
   $ chmod 755 hgweb.cgi
 
 try hgweb request
 
   $ . "$TESTDIR/cgienv"
   $ QUERY_STRING="cmd=changegroup&roots=0000000000000000000000000000000000000000"; export QUERY_STRING
-  $ python hgweb.cgi >page1 2>&1
+  $ $PYTHON hgweb.cgi >page1 2>&1
   $ $PYTHON "$TESTDIR/md5sum.py" page1
   1f424bb22ec05c3c6bc866b6e67efe43  page1
 
 make sure headers are sent even when there is no body
 
-  $ QUERY_STRING="cmd=listkeys&namespace=nosuchnamespace" python hgweb.cgi
+  $ QUERY_STRING="cmd=listkeys&namespace=nosuchnamespace" $PYTHON hgweb.cgi
   Status: 200 Script output follows\r (esc)
   Content-Type: application/mercurial-0.1\r (esc)
   Content-Length: 0\r (esc)
   \r (esc)
--- a/tests/test-command-template.t
+++ b/tests/test-command-template.t
@@ -4248,17 +4248,17 @@ Unparsable alias:
   [255]
 
   $ cd ..
 
 Set up repository for non-ascii encoding tests:
 
   $ hg init nonascii
   $ cd nonascii
-  $ python <<EOF
+  $ $PYTHON <<EOF
   > open('latin1', 'w').write('\xe9')
   > open('utf-8', 'w').write('\xc3\xa9')
   > EOF
   $ HGENCODING=utf-8 hg branch -q `cat utf-8`
   $ HGENCODING=utf-8 hg ci -qAm "non-ascii branch: `cat utf-8`" utf-8
 
 json filter should try round-trip conversion to utf-8:
 
--- a/tests/test-commit-interactive-curses.t
+++ b/tests/test-commit-interactive-curses.t
@@ -337,17 +337,17 @@ Check spacemovesdown
   no changes to record
   [1]
 
 Check ui.interface logic for the chunkselector
 
 The default interface is text
   $ cp $HGRCPATH.pretest $HGRCPATH
   $ chunkselectorinterface() {
-  > python <<EOF
+  > $PYTHON <<EOF
   > from mercurial import hg, ui;\
   > repo = hg.repository(ui.ui.load(), ".");\
   > print repo.ui.interface("chunkselector")
   > EOF
   > }
   $ chunkselectorinterface
   text
 
--- a/tests/test-conflict.t
+++ b/tests/test-conflict.t
@@ -115,17 +115,17 @@ Verify line splitting of custom conflict
   4
   5
   >>>>>>> merge rev:    test 1
   Hop we are done.
 
 Verify line trimming of custom conflict marker using multi-byte characters
 
   $ hg up -q --clean .
-  $ python <<EOF
+  $ $PYTHON <<EOF
   > fp = open('logfile', 'w')
   > fp.write('12345678901234567890123456789012345678901234567890' +
   >          '1234567890') # there are 5 more columns for 80 columns
   > 
   > # 2 x 4 = 8 columns, but 3 x 4 = 12 bytes
   > fp.write(u'\u3042\u3044\u3046\u3048'.encode('utf-8'))
   > 
   > fp.close()
--- a/tests/test-contrib.t
+++ b/tests/test-contrib.t
@@ -21,17 +21,17 @@ Prepare repo-a:
   checking changesets
   checking manifests
   crosschecking files in changesets and manifests
   checking files
   1 files, 3 changesets, 3 total revisions
 
 Dumping revlog of file a to stdout:
 
-  $ python "$CONTRIBDIR/dumprevlog" .hg/store/data/a.i
+  $ $PYTHON "$CONTRIBDIR/dumprevlog" .hg/store/data/a.i
   file: .hg/store/data/a.i
   node: 183d2312b35066fb6b3b449b84efc370d50993d0
   linkrev: 0
   parents: 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000
   length: 15
   -start-
   this is file a
   
@@ -53,24 +53,24 @@ Dumping revlog of file a to stdout:
   this is file a
   adding to file a
   adding more to file a
   
   -end-
 
 Dump all revlogs to file repo.dump:
 
-  $ find .hg/store -name "*.i" | sort | xargs python "$CONTRIBDIR/dumprevlog" > ../repo.dump
+  $ find .hg/store -name "*.i" | sort | xargs $PYTHON "$CONTRIBDIR/dumprevlog" > ../repo.dump
   $ cd ..
 
 Undumping into repo-b:
 
   $ hg init repo-b
   $ cd repo-b
-  $ python "$CONTRIBDIR/undumprevlog" < ../repo.dump
+  $ $PYTHON "$CONTRIBDIR/undumprevlog" < ../repo.dump
   .hg/store/00changelog.i
   .hg/store/00manifest.i
   .hg/store/data/a.i
   $ cd ..
 
 Rebuild fncache with clone --pull:
 
   $ hg clone --pull -U repo-b repo-c
@@ -110,27 +110,27 @@ Test simplemerge command:
   $ echo local > local
   $ cat base >> local
   $ cp local orig
   $ cat base > other
   $ echo other >> other
 
 changing local directly
 
-  $ python simplemerge local base other && echo "merge succeeded"
+  $ $PYTHON simplemerge local base other && echo "merge succeeded"
   merge succeeded
   $ cat local
   local
   base
   other
   $ cp orig local
 
 printing to stdout
 
-  $ python simplemerge -p local base other
+  $ $PYTHON simplemerge -p local base other
   local
   base
   other
 
 local:
 
   $ cat local
   local
@@ -139,89 +139,89 @@ local:
 conflicts
 
   $ cp base conflict-local
   $ cp other conflict-other
   $ echo not other >> conflict-local
   $ echo end >> conflict-local
   $ echo end >> conflict-other
 
-  $ python simplemerge -p conflict-local base conflict-other
+  $ $PYTHON simplemerge -p conflict-local base conflict-other
   base
   <<<<<<< conflict-local
   not other
   =======
   other
   >>>>>>> conflict-other
   end
   [1]
 
 1 label
 
-  $ python simplemerge -p -L foo conflict-local base conflict-other
+  $ $PYTHON simplemerge -p -L foo conflict-local base conflict-other
   base
   <<<<<<< foo
   not other
   =======
   other
   >>>>>>> conflict-other
   end
   [1]
 
 2 labels
 
-  $ python simplemerge -p -L foo -L bar conflict-local base conflict-other
+  $ $PYTHON simplemerge -p -L foo -L bar conflict-local base conflict-other
   base
   <<<<<<< foo
   not other
   =======
   other
   >>>>>>> bar
   end
   [1]
 
 3 labels
 
-  $ python simplemerge -p -L foo -L bar -L base conflict-local base conflict-other
+  $ $PYTHON simplemerge -p -L foo -L bar -L base conflict-local base conflict-other
   base
   <<<<<<< foo
   not other
   end
   ||||||| base
   =======
   other
   end
   >>>>>>> bar
   [1]
 
 too many labels
 
-  $ python simplemerge -p -L foo -L bar -L baz -L buz conflict-local base conflict-other
+  $ $PYTHON simplemerge -p -L foo -L bar -L baz -L buz conflict-local base conflict-other
   abort: can only specify three labels.
   [255]
 
 binary file
 
   $ $PYTHON -c "f = file('binary-local', 'w'); f.write('\x00'); f.close()"
   $ cat orig >> binary-local
-  $ python simplemerge -p binary-local base other
+  $ $PYTHON simplemerge -p binary-local base other
   warning: binary-local looks like a binary file.
   [1]
 
 binary file --text
 
-  $ python simplemerge -a -p binary-local base other 2>&1
+  $ $PYTHON simplemerge -a -p binary-local base other 2>&1
   warning: binary-local looks like a binary file.
   \x00local (esc)
   base
   other
 
 help
 
-  $ python simplemerge --help
+  $ $PYTHON simplemerge --help
   simplemerge [OPTS] LOCAL BASE OTHER
   
       Simple three-way file merge utility with a minimal feature set.
   
       Apply to LOCAL the changes necessary to go from BASE to OTHER.
   
       By default, LOCAL is overwritten with the results of this operation.
   
@@ -230,17 +230,17 @@ help
    -a --text        treat all files as text
    -p --print       print results instead of overwriting LOCAL
       --no-minimal  no effect (DEPRECATED)
    -h --help        display help and exit
    -q --quiet       suppress output
 
 wrong number of arguments
 
-  $ python simplemerge
+  $ $PYTHON simplemerge
   simplemerge: wrong number of arguments
   simplemerge [OPTS] LOCAL BASE OTHER
   
       Simple three-way file merge utility with a minimal feature set.
   
       Apply to LOCAL the changes necessary to go from BASE to OTHER.
   
       By default, LOCAL is overwritten with the results of this operation.
@@ -251,17 +251,17 @@ wrong number of arguments
    -p --print       print results instead of overwriting LOCAL
       --no-minimal  no effect (DEPRECATED)
    -h --help        display help and exit
    -q --quiet       suppress output
   [1]
 
 bad option
 
-  $ python simplemerge --foo -p local base other
+  $ $PYTHON simplemerge --foo -p local base other
   simplemerge: option --foo not recognized
   simplemerge [OPTS] LOCAL BASE OTHER
   
       Simple three-way file merge utility with a minimal feature set.
   
       Apply to LOCAL the changes necessary to go from BASE to OTHER.
   
       By default, LOCAL is overwritten with the results of this operation.
--- a/tests/test-encoding-align.t
+++ b/tests/test-encoding-align.t
@@ -1,15 +1,15 @@
 Test alignment of multibyte characters
 
   $ HGENCODING=utf-8
   $ export HGENCODING
   $ hg init t
   $ cd t
-  $ python << EOF
+  $ $PYTHON << EOF
   > # (byte, width) = (6, 4)
   > s = "\xe7\x9f\xad\xe5\x90\x8d"
   > # (byte, width) = (7, 7): odd width is good for alignment test
   > m = "MIDDLE_"
   > # (byte, width) = (18, 12)
   > l = "\xe9\x95\xb7\xe3\x81\x84\xe9\x95\xb7\xe3\x81\x84\xe5\x90\x8d\xe5\x89\x8d"
   > f = file('s', 'w'); f.write(s); f.close()
   > f = file('m', 'w'); f.write(m); f.close()
--- a/tests/test-encoding.t
+++ b/tests/test-encoding.t
@@ -8,17 +8,17 @@ we need a repo with some legacy latin-1 
   $ hg unbundle "$TESTDIR/bundles/legacy-encoding.hg"
   adding changesets
   adding manifests
   adding file changes
   added 2 changesets with 2 changes to 1 files
   (run 'hg update' to get a working copy)
   $ hg co
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ python << EOF
+  $ $PYTHON << EOF
   > f = file('latin-1', 'w'); f.write("latin-1 e' encoded: \xe9"); f.close()
   > f = file('utf-8', 'w'); f.write("utf-8 e' encoded: \xc3\xa9"); f.close()
   > f = file('latin-1-tag', 'w'); f.write("\xe9"); f.close()
   > EOF
 
 should fail with encoding error
 
   $ echo "plain old ascii" > a
--- a/tests/test-extension.t
+++ b/tests/test-extension.t
@@ -118,17 +118,17 @@ Check hgweb's load order of extensions a
   > from mercurial import demandimport; demandimport.enable()
   > from mercurial.hgweb import hgweb
   > from mercurial.hgweb import wsgicgi
   > application = hgweb('.', 'test repo')
   > wsgicgi.launch(application)
   > EOF
   $ . "$TESTDIR/cgienv"
 
-  $ PATH_INFO='/' SCRIPT_NAME='' python hgweb.cgi \
+  $ PATH_INFO='/' SCRIPT_NAME='' $PYTHON hgweb.cgi \
   >    | grep '^[0-9]) ' # ignores HTML output
   1) foo imported
   1) bar imported
   2) foo uisetup
   2) bar uisetup
   3) foo extsetup
   3) bar extsetup
   4) foo reposetup
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -1641,17 +1641,17 @@ as the second or later byte of multi-byt
 
 For example, "\x8bL\x98^" (translation of "record" in ja_JP.cp932)
 contains 0x4c (L). str.lower() replaces 0x4c(L) by 0x6c(l) and this
 replacement makes message meaningless.
 
 This tests that section lookup by translated string isn't broken by
 such str.lower().
 
-  $ python <<EOF
+  $ $PYTHON <<EOF
   > def escape(s):
   >     return ''.join('\u%x' % ord(uc) for uc in s.decode('cp932'))
   > # translation of "record" in ja_JP.cp932
   > upper = "\x8bL\x98^"
   > # str.lower()-ed section name should be treated as different one
   > lower = "\x8bl\x98^"
   > with open('ambiguous.py', 'w') as fp:
   >     fp.write("""# ambiguous section names in ja_JP.cp932
@@ -1675,27 +1675,27 @@ such str.lower().
   > """ % (escape(upper), escape(lower)))
   > EOF
 
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
   > ambiguous = ./ambiguous.py
   > EOF
 
-  $ python <<EOF | sh
+  $ $PYTHON <<EOF | sh
   > upper = "\x8bL\x98^"
   > print "hg --encoding cp932 help -e ambiguous.%s" % upper
   > EOF
   \x8bL\x98^ (esc)
   ----
   
   Upper name should show only this message
   
 
-  $ python <<EOF | sh
+  $ $PYTHON <<EOF | sh
   > lower = "\x8bl\x98^"
   > print "hg --encoding cp932 help -e ambiguous.%s" % lower
   > EOF
   \x8bl\x98^ (esc)
   ----
   
   Lower name should show only this message
   
--- a/tests/test-hgweb-commands.t
+++ b/tests/test-hgweb-commands.t
@@ -2260,69 +2260,69 @@ bookmarks view doesn't choke on bookmark
   > from mercurial.hgweb import hgweb
   > from mercurial.hgweb import wsgicgi
   > app = hgweb('.', 'test')
   > wsgicgi.launch(app)
   > HGWEB
   $ . "$TESTDIR/cgienv"
   $ PATH_INFO=/bookmarks; export PATH_INFO
   $ QUERY_STRING='style=raw'
-  $ python hgweb.cgi | grep -v ETag:
+  $ $PYTHON hgweb.cgi | grep -v ETag:
   Status: 200 Script output follows\r (esc)
   Content-Type: text/plain; charset=ascii\r (esc)
   \r (esc)
 
 listbookmarks hides secret bookmarks
 
   $ PATH_INFO=/; export PATH_INFO
   $ QUERY_STRING='cmd=listkeys&namespace=bookmarks'
-  $ python hgweb.cgi
+  $ $PYTHON hgweb.cgi
   Status: 200 Script output follows\r (esc)
   Content-Type: application/mercurial-0.1\r (esc)
   Content-Length: 0\r (esc)
   \r (esc)
 
 search works with filtering
 
   $ PATH_INFO=/log; export PATH_INFO
   $ QUERY_STRING='rev=babar'
-  $ python hgweb.cgi > search
+  $ $PYTHON hgweb.cgi > search
   $ grep Status search
   Status: 200 Script output follows\r (esc)
 
 summary works with filtering (issue3810)
 
   $ PATH_INFO=/summary; export PATH_INFO
   $ QUERY_STRING='style=monoblue'; export QUERY_STRING
-  $ python hgweb.cgi > summary.out
+  $ $PYTHON hgweb.cgi > summary.out
   $ grep "^Status" summary.out
   Status: 200 Script output follows\r (esc)
 
 proper status for filtered revision
 
 
 (missing rev)
 
   $ PATH_INFO=/rev/5; export PATH_INFO
   $ QUERY_STRING='style=raw'
-  $ python hgweb.cgi #> search
+  $ $PYTHON hgweb.cgi #> search
   Status: 404 Not Found\r (esc)
   ETag: W/"*"\r (glob) (esc)
   Content-Type: text/plain; charset=ascii\r (esc)
   \r (esc)
   
   error: filtered revision '5' (not in 'served' subset)
 
 
 
 (filtered rev)
 
   $ PATH_INFO=/rev/4; export PATH_INFO
   $ QUERY_STRING='style=raw'
-  $ python hgweb.cgi #> search
+  $ $PYTHON hgweb.cgi #> search
   Status: 404 Not Found\r (esc)
   ETag: W/"*"\r (glob) (esc)
   Content-Type: text/plain; charset=ascii\r (esc)
   \r (esc)
   
   error: filtered revision '4' (not in 'served' subset)
 
 filtered '0' changeset
@@ -2340,21 +2340,21 @@ filtered '0' changeset
   grafting 2:ab4f1438558b "2"
   grafting 3:ada793dcc118 "3"
   grafting 4:b60a39a85a01 "4" (secret)
   grafting 5:aed2d9c1d0e7 "5"
 (turning the initial root secret (filtered))
   $ hg phase --force --secret 0
   $ PATH_INFO=/graph/; export PATH_INFO
   $ QUERY_STRING=''
-  $ python hgweb.cgi | grep Status
+  $ $PYTHON hgweb.cgi | grep Status
   Status: 200 Script output follows\r (esc)
 (check rendered revision)
   $ QUERY_STRING='style=raw'
-  $ python hgweb.cgi | grep -v ETag
+  $ $PYTHON hgweb.cgi | grep -v ETag
   Status: 200 Script output follows\r (esc)
   Content-Type: text/plain; charset=ascii\r (esc)
   \r (esc)
   
   # HG graph
   # Node ID 1d9b947fef1fbb382a95c11a8f5a67e9a10b5026
   # Rows shown 7
   
--- a/tests/test-histedit-arguments.t
+++ b/tests/test-histedit-arguments.t
@@ -274,17 +274,17 @@ short hash. This tests issue3893.
   created new head
   $ hg histedit -r 'heads(all())'
   abort: The specified revisions must have exactly one common root
   [255]
 
 Test that trimming description using multi-byte characters
 --------------------------------------------------------------------
 
-  $ python <<EOF
+  $ $PYTHON <<EOF
   > fp = open('logfile', 'w')
   > fp.write('12345678901234567890123456789012345678901234567890' +
   >          '12345') # there are 5 more columns for 80 columns
   > 
   > # 2 x 4 = 8 columns, but 3 x 4 = 12 bytes
   > fp.write(u'\u3042\u3044\u3046\u3048'.encode('utf-8'))
   > 
   > fp.close()
--- a/tests/test-imports-checker.t
+++ b/tests/test-imports-checker.t
@@ -3,17 +3,17 @@
   $ . "$TESTDIR/helpers-testrepo.sh"
   $ testrepohgenv
   $ import_checker="$TESTDIR"/../contrib/import-checker.py
 
 Run the doctests from the import checker, and make sure
 it's working correctly.
   $ TERM=dumb
   $ export TERM
-  $ python -m doctest $import_checker
+  $ $PYTHON -m doctest $import_checker
 
 Run additional tests for the import checker
 
   $ mkdir testpackage
   $ touch testpackage/__init__.py
 
   $ cat > testpackage/multiple.py << EOF
   > from __future__ import absolute_import
--- a/tests/test-largefiles.t
+++ b/tests/test-largefiles.t
@@ -220,17 +220,17 @@ Test largefiles can be loaded in hgweb (
   > from mercurial.hgweb import hgweb
   > from mercurial.hgweb import wsgicgi
   > application = hgweb('.', 'test repo')
   > wsgicgi.launch(application)
   > EOF
   $ . "$TESTDIR/cgienv"
 
   $ SCRIPT_NAME='' \
-  > python "$TESTTMP/hgweb.cgi" > /dev/null
+  > $PYTHON "$TESTTMP/hgweb.cgi" > /dev/null
 
 Test archiving the various revisions.  These hit corner cases known with
 archiving.
 
   $ hg archive -r 0 ../archive0
   $ hg archive -r 1 ../archive1
   $ hg archive -r 2 ../archive2
   $ hg archive -r 3 ../archive3
--- a/tests/test-log.t
+++ b/tests/test-log.t
@@ -1785,33 +1785,33 @@ clear extensions configuration
 test -u/-k for problematic encoding
 # unicode: cp932:
 # u30A2    0x83 0x41(= 'A')
 # u30C2    0x83 0x61(= 'a')
 
   $ hg init problematicencoding
   $ cd problematicencoding
 
-  $ python > setup.sh <<EOF
+  $ $PYTHON > setup.sh <<EOF
   > print u'''
   > echo a > text
   > hg add text
   > hg --encoding utf-8 commit -u '\u30A2' -m none
   > echo b > text
   > hg --encoding utf-8 commit -u '\u30C2' -m none
   > echo c > text
   > hg --encoding utf-8 commit -u none -m '\u30A2'
   > echo d > text
   > hg --encoding utf-8 commit -u none -m '\u30C2'
   > '''.encode('utf-8')
   > EOF
   $ sh < setup.sh
 
 test in problematic encoding
-  $ python > test.sh <<EOF
+  $ $PYTHON > test.sh <<EOF
   > print u'''
   > hg --encoding cp932 log --template '{rev}\\n' -u '\u30A2'
   > echo ====
   > hg --encoding cp932 log --template '{rev}\\n' -u '\u30C2'
   > echo ====
   > hg --encoding cp932 log --template '{rev}\\n' -k '\u30A2'
   > echo ====
   > hg --encoding cp932 log --template '{rev}\\n' -k '\u30C2'
--- a/tests/test-mq.t
+++ b/tests/test-mq.t
@@ -1579,17 +1579,17 @@ Test that secret mq patch does not break
   > HGWEB
   $ . "$TESTDIR/cgienv"
 #if msys
   $ PATH_INFO=//tags; export PATH_INFO
 #else
   $ PATH_INFO=/tags; export PATH_INFO
 #endif
   $ QUERY_STRING='style=raw'
-  $ python hgweb.cgi | grep '^tip'
+  $ $PYTHON hgweb.cgi | grep '^tip'
   tip	[0-9a-f]{40} (re)
 
   $ cd ..
 
 Test interaction with revset (issue4426)
 
   $ hg init issue4426
   $ cd issue4426
--- a/tests/test-newcgi.t
+++ b/tests/test-newcgi.t
@@ -47,20 +47,20 @@ before d74fc8dec2b4 still work.
   >     return hgwebdir("hgweb.config")
   > 
   > wsgicgi.launch(wsgiapplication(make_web_app))
   > HGWEBDIR
 
   $ chmod 755 hgwebdir.cgi
 
   $ . "$TESTDIR/cgienv"
-  $ python hgweb.cgi > page1
-  $ python hgwebdir.cgi > page2
+  $ $PYTHON hgweb.cgi > page1
+  $ $PYTHON hgwebdir.cgi > page2
 
   $ PATH_INFO="/test/"
   $ PATH_TRANSLATED="/var/something/test.cgi"
   $ REQUEST_URI="/test/test/"
   $ SCRIPT_URI="http://hg.omnifarious.org/test/test/"
   $ SCRIPT_URL="/test/test/"
-  $ python hgwebdir.cgi > page3
+  $ $PYTHON hgwebdir.cgi > page3
 
   $ grep -i error page1 page2 page3
   [1]
--- a/tests/test-newercgi.t
+++ b/tests/test-newercgi.t
@@ -41,20 +41,20 @@ This is a rudimentary test of the CGI fi
   > 
   > application = hgwebdir("hgweb.config")
   > wsgicgi.launch(application)
   > HGWEBDIR
 
   $ chmod 755 hgwebdir.cgi
 
   $ . "$TESTDIR/cgienv"
-  $ python hgweb.cgi > page1
-  $ python hgwebdir.cgi > page2
+  $ $PYTHON hgweb.cgi > page1
+  $ $PYTHON hgwebdir.cgi > page2
 
   $ PATH_INFO="/test/"
   $ PATH_TRANSLATED="/var/something/test.cgi"
   $ REQUEST_URI="/test/test/"
   $ SCRIPT_URI="http://hg.omnifarious.org/test/test/"
   $ SCRIPT_URL="/test/test/"
-  $ python hgwebdir.cgi > page3
+  $ $PYTHON hgwebdir.cgi > page3
 
   $ grep -i error page1 page2 page3
   [1]
--- a/tests/test-oldcgi.t
+++ b/tests/test-oldcgi.t
@@ -57,20 +57,20 @@ This tests if CGI files from before d0db
   > 
   > h = hgweb.hgwebdir("hgweb.config")
   > h.run()
   > HGWEBDIR
 
   $ chmod 755 hgwebdir.cgi
 
   $ . "$TESTDIR/cgienv"
-  $ python hgweb.cgi > page1
-  $ python hgwebdir.cgi > page2
+  $ $PYTHON hgweb.cgi > page1
+  $ $PYTHON hgwebdir.cgi > page2
 
   $ PATH_INFO="/test/"
   $ PATH_TRANSLATED="/var/something/test.cgi"
   $ REQUEST_URI="/test/test/"
   $ SCRIPT_URI="http://hg.omnifarious.org/test/test/"
   $ SCRIPT_URL="/test/test/"
-  $ python hgwebdir.cgi > page3
+  $ $PYTHON hgwebdir.cgi > page3
 
   $ grep -i error page1 page2 page3
   [1]
--- a/tests/test-parseindex.t
+++ b/tests/test-parseindex.t
@@ -61,17 +61,17 @@ We approximate that by reducing the read
   $ cd ..
 
 #if no-pure
 
 Test SEGV caused by bad revision passed to reachableroots() (issue4775):
 
   $ cd a
 
-  $ python <<EOF
+  $ $PYTHON <<EOF
   > from mercurial import changelog, vfs
   > cl = changelog.changelog(vfs.vfs('.hg/store'))
   > print 'good heads:'
   > for head in [0, len(cl) - 1, -1]:
   >     print'%s: %r' % (head, cl.reachableroots(0, [head], [0]))
   > print 'bad heads:'
   > for head in [len(cl), 10000, -2, -10000, None]:
   >     print '%s:' % head,
@@ -123,17 +123,17 @@ Test corrupted p1/p2 fields that could c
 
   $ mkdir invalidparent
   $ cd invalidparent
 
   $ hg clone --pull -q --config phases.publish=False ../a limit
   $ hg clone --pull -q --config phases.publish=False ../a segv
   $ rm -R limit/.hg/cache segv/.hg/cache
 
-  $ python <<EOF
+  $ $PYTHON <<EOF
   > data = open("limit/.hg/store/00changelog.i", "rb").read()
   > for n, p in [('limit', '\0\0\0\x02'), ('segv', '\0\x01\0\0')]:
   >     # corrupt p1 at rev0 and p2 at rev1
   >     d = data[:24] + p + data[28:127 + 28] + p + data[127 + 32:]
   >     open(n + "/.hg/store/00changelog.i", "wb").write(d)
   > EOF
 
   $ hg debugindex -f1 limit/.hg/store/00changelog.i
--- a/tests/test-purge.t
+++ b/tests/test-purge.t
@@ -44,17 +44,17 @@ delete an untracked directory
   $ ls
   directory
   r1
 
 delete an untracked file
 
   $ touch untracked_file
   $ touch untracked_file_readonly
-  $ python <<EOF
+  $ $PYTHON <<EOF
   > import os, stat
   > f= 'untracked_file_readonly'
   > os.chmod(f, stat.S_IMODE(os.stat(f).st_mode) & ~stat.S_IWRITE)
   > EOF
   $ hg purge -p
   untracked_file
   untracked_file_readonly
   $ hg purge -v
--- a/tests/test-push-cgi.t
+++ b/tests/test-push-cgi.t
@@ -33,59 +33,59 @@ test preparation
   $ CONTENT_TYPE="application/octet-stream"; export CONTENT_TYPE
   $ hg bundle --type v1 --all bundle.hg
   1 changesets found
   $ CONTENT_LENGTH=279; export CONTENT_LENGTH;
 
 expect failure because heads doesn't match (formerly known as 'unsynced changes')
 
   $ QUERY_STRING="cmd=unbundle&heads=0000000000000000000000000000000000000000"; export QUERY_STRING
-  $ python hgweb.cgi <bundle.hg >page1 2>&1
+  $ $PYTHON hgweb.cgi <bundle.hg >page1 2>&1
   $ cat page1
   Status: 200 Script output follows\r (esc)
   Content-Type: application/mercurial-0.1\r (esc)
   Content-Length: 64\r (esc)
   \r (esc)
   0
   repository changed while preparing changes - please try again
 
 successful force push
 
   $ QUERY_STRING="cmd=unbundle&heads=666f726365"; export QUERY_STRING
-  $ python hgweb.cgi <bundle.hg >page2 2>&1
+  $ $PYTHON hgweb.cgi <bundle.hg >page2 2>&1
   $ cat page2
   Status: 200 Script output follows\r (esc)
   Content-Type: application/mercurial-0.1\r (esc)
   Content-Length: 102\r (esc)
   \r (esc)
   1
   adding changesets
   adding manifests
   adding file changes
   added 0 changesets with 0 changes to 1 files
 
 successful push, list of heads
 
   $ QUERY_STRING="cmd=unbundle&heads=f7b1eb17ad24730a1651fccd46c43826d1bbc2ac"; export QUERY_STRING
-  $ python hgweb.cgi <bundle.hg >page3 2>&1
+  $ $PYTHON hgweb.cgi <bundle.hg >page3 2>&1
   $ cat page3
   Status: 200 Script output follows\r (esc)
   Content-Type: application/mercurial-0.1\r (esc)
   Content-Length: 102\r (esc)
   \r (esc)
   1
   adding changesets
   adding manifests
   adding file changes
   added 0 changesets with 0 changes to 1 files
 
 successful push, SHA1 hash of heads (unbundlehash capability)
 
   $ QUERY_STRING="cmd=unbundle&heads=686173686564 5a785a5f9e0d433b88ed862b206b011b0c3a9d13"; export QUERY_STRING
-  $ python hgweb.cgi <bundle.hg >page4 2>&1
+  $ $PYTHON hgweb.cgi <bundle.hg >page4 2>&1
   $ cat page4
   Status: 200 Script output follows\r (esc)
   Content-Type: application/mercurial-0.1\r (esc)
   Content-Length: 102\r (esc)
   \r (esc)
   1
   adding changesets
   adding manifests
--- a/tests/test-push-race.t
+++ b/tests/test-push-race.t
@@ -86,17 +86,17 @@ A set of extension and shell functions e
   >              break
   >         fi;
   >     done
   >     [ ! -f $1 ] || echo "delay file still exist: $1"
   > }
 
   $ cat >> $HGRCPATH << EOF
   > [ui]
-  > ssh = python "$TESTDIR/dummyssh"
+  > ssh = $PYTHON "$TESTDIR/dummyssh"
   > # simplify output
   > logtemplate = {node|short} {desc} ({branch})
   > [phases]
   > publish = no
   > [experimental]
   > evolution = all
   > [alias]
   > graph = log -G --rev 'sort(all(), "topo")'
--- a/tests/test-revset.t
+++ b/tests/test-revset.t
@@ -4175,33 +4175,33 @@ unless explicitly specified (issue4682)
 test author/desc/keyword in problematic encoding
 # unicode: cp932:
 # u30A2    0x83 0x41(= 'A')
 # u30C2    0x83 0x61(= 'a')
 
   $ hg init problematicencoding
   $ cd problematicencoding
 
-  $ python > setup.sh <<EOF
+  $ $PYTHON > setup.sh <<EOF
   > print u'''
   > echo a > text
   > hg add text
   > hg --encoding utf-8 commit -u '\u30A2' -m none
   > echo b > text
   > hg --encoding utf-8 commit -u '\u30C2' -m none
   > echo c > text
   > hg --encoding utf-8 commit -u none -m '\u30A2'
   > echo d > text
   > hg --encoding utf-8 commit -u none -m '\u30C2'
   > '''.encode('utf-8')
   > EOF
   $ sh < setup.sh
 
 test in problematic encoding
-  $ python > test.sh <<EOF
+  $ $PYTHON > test.sh <<EOF
   > print u'''
   > hg --encoding cp932 log --template '{rev}\\n' -r 'author(\u30A2)'
   > echo ====
   > hg --encoding cp932 log --template '{rev}\\n' -r 'author(\u30C2)'
   > echo ====
   > hg --encoding cp932 log --template '{rev}\\n' -r 'desc(\u30A2)'
   > echo ====
   > hg --encoding cp932 log --template '{rev}\\n' -r 'desc(\u30C2)'
--- a/tests/test-ssh-bundle1.t
+++ b/tests/test-ssh-bundle1.t
@@ -140,17 +140,17 @@ local change
 
   $ echo bleah > foo
   $ hg ci -m "add"
 
 updating rc
 
   $ echo "default-push = ssh://user@dummy/remote" >> .hg/hgrc
   $ echo "[ui]" >> .hg/hgrc
-  $ echo "ssh = python \"$TESTDIR/dummyssh\"" >> .hg/hgrc
+  $ echo "ssh = $PYTHON \"$TESTDIR/dummyssh\"" >> .hg/hgrc
 
 find outgoing
 
   $ hg out ssh://user@dummy/remote
   comparing with ssh://user@dummy/remote
   searching for changes
   changeset:   3:a28a9d1a809c
   tag:         tip
@@ -267,17 +267,17 @@ test pushkeys and bookmarks
 a bad, evil hook that prints to stdout
 
   $ cat <<EOF > $TESTTMP/badhook
   > import sys
   > sys.stdout.write("KABOOM\n")
   > EOF
 
   $ echo '[hooks]' >> ../remote/.hg/hgrc
-  $ echo "changegroup.stdout = python $TESTTMP/badhook" >> ../remote/.hg/hgrc
+  $ echo "changegroup.stdout = $PYTHON $TESTTMP/badhook" >> ../remote/.hg/hgrc
   $ echo r > r
   $ hg ci -A -m z r
 
 push should succeed even though it has an unexpected response
 
   $ hg push
   pushing to ssh://user@dummy/remote
   searching for changes
@@ -358,45 +358,45 @@ have been cleared by a hg.exe wrapper) a
 parameters:
 
   $ cat > ssh.sh << EOF
   > userhost="\$1"
   > SSH_ORIGINAL_COMMAND="\$2"
   > export SSH_ORIGINAL_COMMAND
   > PYTHONPATH="$PYTHONPATH"
   > export PYTHONPATH
-  > python "$TESTDIR/../contrib/hg-ssh" "$TESTTMP/a repo"
+  > $PYTHON "$TESTDIR/../contrib/hg-ssh" "$TESTTMP/a repo"
   > EOF
 
   $ hg id --ssh "sh ssh.sh" "ssh://user@dummy/a repo"
   73649e48688a
 
   $ hg id --ssh "sh ssh.sh" "ssh://user@dummy/a'repo"
   remote: Illegal repository "$TESTTMP/a'repo" (glob)
   abort: no suitable response from remote hg!
   [255]
 
   $ hg id --ssh "sh ssh.sh" --remotecmd hacking "ssh://user@dummy/a'repo"
   remote: Illegal command "hacking -R 'a'\''repo' serve --stdio"
   abort: no suitable response from remote hg!
   [255]
 
-  $ SSH_ORIGINAL_COMMAND="'hg' serve -R 'a'repo' --stdio" python "$TESTDIR/../contrib/hg-ssh"
+  $ SSH_ORIGINAL_COMMAND="'hg' serve -R 'a'repo' --stdio" $PYTHON "$TESTDIR/../contrib/hg-ssh"
   Illegal command "'hg' serve -R 'a'repo' --stdio": No closing quotation
   [255]
 
 Test hg-ssh in read-only mode:
 
   $ cat > ssh.sh << EOF
   > userhost="\$1"
   > SSH_ORIGINAL_COMMAND="\$2"
   > export SSH_ORIGINAL_COMMAND
   > PYTHONPATH="$PYTHONPATH"
   > export PYTHONPATH
-  > python "$TESTDIR/../contrib/hg-ssh" --read-only "$TESTTMP/remote"
+  > $PYTHON "$TESTDIR/../contrib/hg-ssh" --read-only "$TESTTMP/remote"
   > EOF
 
   $ hg clone --ssh "sh ssh.sh" "ssh://user@dummy/$TESTTMP/remote" read-only-local
   requesting all changes
   adding changesets
   adding manifests
   adding file changes
   added 6 changesets with 5 changes to 4 files (+1 heads)
@@ -435,17 +435,17 @@ stderr from remote commands should be pr
   > def extsetup(ui):
   >     extensions.wrapfunction(exchange, 'push', wrappedpush)
   > EOF
 
   $ cat >> .hg/hgrc << EOF
   > [paths]
   > default-push = ssh://user@dummy/remote
   > [ui]
-  > ssh = python "$TESTDIR/dummyssh"
+  > ssh = $PYTHON "$TESTDIR/dummyssh"
   > [extensions]
   > localwrite = localwrite.py
   > EOF
 
   $ echo localwrite > foo
   $ hg commit -m 'testing localwrite'
   $ hg push
   pushing to ssh://user@dummy/remote
@@ -456,17 +456,17 @@ stderr from remote commands should be pr
   remote: added 1 changesets with 1 changes to 1 files
   remote: KABOOM
   local stdout
 
 debug output
 
   $ hg pull --debug ssh://user@dummy/remote
   pulling from ssh://user@dummy/remote
-  running python ".*/dummyssh" user@dummy ('|")hg -R remote serve --stdio('|") (re)
+  running .* ".*/dummyssh" user@dummy ('|")hg -R remote serve --stdio('|") (re)
   sending hello command
   sending between command
   remote: 355
   remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 bundle2=HG20%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN
   remote: 1
   preparing listkeys for "bookmarks"
   sending listkeys command
   received listkey for "bookmarks": 45 bytes
--- a/tests/test-ssh.t
+++ b/tests/test-ssh.t
@@ -134,17 +134,17 @@ local change
 
   $ echo bleah > foo
   $ hg ci -m "add"
 
 updating rc
 
   $ echo "default-push = ssh://user@dummy/remote" >> .hg/hgrc
   $ echo "[ui]" >> .hg/hgrc
-  $ echo "ssh = python \"$TESTDIR/dummyssh\"" >> .hg/hgrc
+  $ echo "ssh = $PYTHON \"$TESTDIR/dummyssh\"" >> .hg/hgrc
 
 find outgoing
 
   $ hg out ssh://user@dummy/remote
   comparing with ssh://user@dummy/remote
   searching for changes
   changeset:   3:a28a9d1a809c
   tag:         tip
@@ -268,17 +268,17 @@ a bad, evil hook that prints to stdout
   $ cat <<EOF > $TESTTMP/badpyhook.py
   > import sys
   > def hook(ui, repo, hooktype, **kwargs):
   >     sys.stdout.write("KABOOM IN PROCESS\n")
   > EOF
 
   $ cat <<EOF >> ../remote/.hg/hgrc
   > [hooks]
-  > changegroup.stdout = python $TESTTMP/badhook
+  > changegroup.stdout = $PYTHON $TESTTMP/badhook
   > changegroup.pystdout = python:$TESTTMP/badpyhook.py:hook
   > EOF
   $ echo r > r
   $ hg ci -A -m z r
 
 push should succeed even though it has an unexpected response
 
   $ hg push
@@ -375,45 +375,45 @@ have been cleared by a hg.exe wrapper) a
 parameters:
 
   $ cat > ssh.sh << EOF
   > userhost="\$1"
   > SSH_ORIGINAL_COMMAND="\$2"
   > export SSH_ORIGINAL_COMMAND
   > PYTHONPATH="$PYTHONPATH"
   > export PYTHONPATH
-  > python "$TESTDIR/../contrib/hg-ssh" "$TESTTMP/a repo"
+  > $PYTHON "$TESTDIR/../contrib/hg-ssh" "$TESTTMP/a repo"
   > EOF
 
   $ hg id --ssh "sh ssh.sh" "ssh://user@dummy/a repo"
   73649e48688a
 
   $ hg id --ssh "sh ssh.sh" "ssh://user@dummy/a'repo"
   remote: Illegal repository "$TESTTMP/a'repo" (glob)
   abort: no suitable response from remote hg!
   [255]
 
   $ hg id --ssh "sh ssh.sh" --remotecmd hacking "ssh://user@dummy/a'repo"
   remote: Illegal command "hacking -R 'a'\''repo' serve --stdio"
   abort: no suitable response from remote hg!
   [255]
 
-  $ SSH_ORIGINAL_COMMAND="'hg' -R 'a'repo' serve --stdio" python "$TESTDIR/../contrib/hg-ssh"
+  $ SSH_ORIGINAL_COMMAND="'hg' -R 'a'repo' serve --stdio" $PYTHON "$TESTDIR/../contrib/hg-ssh"
   Illegal command "'hg' -R 'a'repo' serve --stdio": No closing quotation
   [255]
 
 Test hg-ssh in read-only mode:
 
   $ cat > ssh.sh << EOF
   > userhost="\$1"
   > SSH_ORIGINAL_COMMAND="\$2"
   > export SSH_ORIGINAL_COMMAND
   > PYTHONPATH="$PYTHONPATH"
   > export PYTHONPATH
-  > python "$TESTDIR/../contrib/hg-ssh" --read-only "$TESTTMP/remote"
+  > $PYTHON "$TESTDIR/../contrib/hg-ssh" --read-only "$TESTTMP/remote"
   > EOF
 
   $ hg clone --ssh "sh ssh.sh" "ssh://user@dummy/$TESTTMP/remote" read-only-local
   requesting all changes
   adding changesets
   adding manifests
   adding file changes
   added 6 changesets with 5 changes to 4 files (+1 heads)
@@ -450,17 +450,17 @@ stderr from remote commands should be pr
   > def extsetup(ui):
   >     extensions.wrapfunction(exchange, 'push', wrappedpush)
   > EOF
 
   $ cat >> .hg/hgrc << EOF
   > [paths]
   > default-push = ssh://user@dummy/remote
   > [ui]
-  > ssh = python "$TESTDIR/dummyssh"
+  > ssh = $PYTHON "$TESTDIR/dummyssh"
   > [extensions]
   > localwrite = localwrite.py
   > EOF
 
   $ echo localwrite > foo
   $ hg commit -m 'testing localwrite'
   $ hg push
   pushing to ssh://user@dummy/remote
@@ -472,17 +472,17 @@ stderr from remote commands should be pr
   remote: KABOOM
   remote: KABOOM IN PROCESS
   local stdout
 
 debug output
 
   $ hg pull --debug ssh://user@dummy/remote
   pulling from ssh://user@dummy/remote
-  running python ".*/dummyssh" user@dummy ('|")hg -R remote serve --stdio('|") (re)
+  running .* ".*/dummyssh" user@dummy ('|")hg -R remote serve --stdio('|") (re)
   sending hello command
   sending between command
   remote: 355
   remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 bundle2=HG20%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN
   remote: 1
   query 1; heads
   sending batch command
   searching for changes
--- a/tests/test-tag.t
+++ b/tests/test-tag.t
@@ -225,29 +225,29 @@ cloning local tags
   hook: +A acb14030fe0a21b60322c440ad2d20cf7685a376 bleah
   $ hg -R test3 parents --style=compact
 
   $ cd test
 
 Issue601: hg tag doesn't do the right thing if .hgtags or localtags
 doesn't end with EOL
 
-  $ python << EOF
+  $ $PYTHON << EOF
   > f = file('.hg/localtags'); last = f.readlines()[-1][:-1]; f.close()
   > f = file('.hg/localtags', 'w'); f.write(last); f.close()
   > EOF
   $ cat .hg/localtags; echo
   acb14030fe0a21b60322c440ad2d20cf7685a376 localblah
   $ hg tag -l localnewline
   $ cat .hg/localtags; echo
   acb14030fe0a21b60322c440ad2d20cf7685a376 localblah
   c2899151f4e76890c602a2597a650a72666681bf localnewline
   
 
-  $ python << EOF
+  $ $PYTHON << EOF
   > f = file('.hgtags'); last = f.readlines()[-1][:-1]; f.close()
   > f = file('.hgtags', 'w'); f.write(last); f.close()
   > EOF
   $ hg ci -m'broken manual edit of .hgtags'
   $ cat .hgtags; echo
   acb14030fe0a21b60322c440ad2d20cf7685a376 foobar
   $ hg tag newline
   hook: tag changes detected