Patchwork [2,of,2] tests: replace yet more calls to `python` with $PYTHON

login
register
mail settings
Submitter Augie Fackler
Date June 29, 2017, 8:17 p.m.
Message ID <298f967da627a90149e8.1498767431@augie-macbookpro2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/21844/
State Changes Requested
Headers show

Comments

Augie Fackler - June 29, 2017, 8:17 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1497993027 14400
#      Tue Jun 20 17:10:27 2017 -0400
# Node ID 298f967da627a90149e823cf9ae11fc503029d9f
# Parent  8238b8e8920aee16caa57b97aef8bc988559c67b
tests: replace yet more calls to `python` with $PYTHON

Summary: These are some simple cases. More to come in a future change.

Reviewers: krbullock

Differential Revision: https://hg-phab.durin42.com/D4
Augie Fackler - June 29, 2017, 8:18 p.m.
> On Jun 29, 2017, at 16:17, Augie Fackler <raf@durin42.com> wrote:
> 
> # HG changeset patch
> # User Augie Fackler <augie@google.com>
> # Date 1497993027 14400
> #      Tue Jun 20 17:10:27 2017 -0400
> # Node ID 298f967da627a90149e823cf9ae11fc503029d9f
> # Parent  8238b8e8920aee16caa57b97aef8bc988559c67b
> tests: replace yet more calls to `python` with $PYTHON
> 
> Summary: These are some simple cases. More to come in a future change.
> 
> Reviewers: krbullock
> 
> Differential Revision: https://hg-phab.durin42.com/D4

I've mailed these patches here, but they're also in the experimental phabricator we've set up. I figured I'd use these patches (and some subsequent ones I've got) as test candidates since they're the exact kind of change that's a ton easier in phabricator.

(We'll make a bigger email about phabricator with details on the experiment once we get the kinks worked out.)

> 
> diff --git a/tests/test-bundle2-pushback.t b/tests/test-bundle2-pushback.t
> --- a/tests/test-bundle2-pushback.t
> +++ b/tests/test-bundle2-pushback.t
> @@ -25,7 +25,7 @@
> 
>   $ cat >> $HGRCPATH <<EOF
>> [ui]
> -  > ssh = python "$TESTDIR/dummyssh"
> +  > ssh = $PYTHON "$TESTDIR/dummyssh"
>> username = nobody <no.reply@example.com>
>> 
>> [alias]
> diff --git a/tests/test-check-module-imports.t b/tests/test-check-module-imports.t
> --- a/tests/test-check-module-imports.t
> +++ b/tests/test-check-module-imports.t
> @@ -37,4 +37,4 @@ outputs, which should be fixed later.
>> -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" -
> diff --git a/tests/test-clone-cgi.t b/tests/test-clone-cgi.t
> --- a/tests/test-clone-cgi.t
> +++ b/tests/test-clone-cgi.t
> @@ -26,13 +26,13 @@ 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)
> diff --git a/tests/test-command-template.t b/tests/test-command-template.t
> --- a/tests/test-command-template.t
> +++ b/tests/test-command-template.t
> @@ -4253,7 +4253,7 @@ Set up repository for non-ascii encoding
> 
>   $ hg init nonascii
>   $ cd nonascii
> -  $ python <<EOF
> +  $ $PYTHON <<EOF
>> open('latin1', 'w').write('\xe9')
>> open('utf-8', 'w').write('\xc3\xa9')
>> EOF
> diff --git a/tests/test-commit-interactive-curses.t b/tests/test-commit-interactive-curses.t
> --- a/tests/test-commit-interactive-curses.t
> +++ b/tests/test-commit-interactive-curses.t
> @@ -342,7 +342,7 @@ Check ui.interface logic for the chunkse
> 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")
> diff --git a/tests/test-conflict.t b/tests/test-conflict.t
> --- a/tests/test-conflict.t
> +++ b/tests/test-conflict.t
> @@ -120,7 +120,7 @@ Verify line splitting of custom conflict
> 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
> diff --git a/tests/test-contrib.t b/tests/test-contrib.t
> --- a/tests/test-contrib.t
> +++ b/tests/test-contrib.t
> @@ -26,7 +26,7 @@ Prepare repo-a:
> 
> 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
> @@ -58,14 +58,14 @@ Dumping revlog of file a to stdout:
> 
> 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
> @@ -115,7 +115,7 @@ Test simplemerge command:
> 
> changing local directly
> 
> -  $ python simplemerge local base other && echo "merge succeeded"
> +  $ $PYTHON simplemerge local base other && echo "merge succeeded"
>   merge succeeded
>   $ cat local
>   local
> @@ -125,7 +125,7 @@ changing local directly
> 
> printing to stdout
> 
> -  $ python simplemerge -p local base other
> +  $ $PYTHON simplemerge -p local base other
>   local
>   base
>   other
> @@ -144,7 +144,7 @@ conflicts
>   $ 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
> @@ -156,7 +156,7 @@ conflicts
> 
> 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
> @@ -168,7 +168,7 @@ 1 label
> 
> 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
> @@ -180,7 +180,7 @@ 2 labels
> 
> 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
> @@ -194,7 +194,7 @@ 3 labels
> 
> 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]
> 
> @@ -202,13 +202,13 @@ 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
> @@ -216,7 +216,7 @@ binary file --text
> 
> help
> 
> -  $ python simplemerge --help
> +  $ $PYTHON simplemerge --help
>   simplemerge [OPTS] LOCAL BASE OTHER
> 
>       Simple three-way file merge utility with a minimal feature set.
> @@ -235,7 +235,7 @@ help
> 
> wrong number of arguments
> 
> -  $ python simplemerge
> +  $ $PYTHON simplemerge
>   simplemerge: wrong number of arguments
>   simplemerge [OPTS] LOCAL BASE OTHER
> 
> @@ -256,7 +256,7 @@ wrong number of arguments
> 
> 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
> 
> diff --git a/tests/test-encoding-align.t b/tests/test-encoding-align.t
> --- a/tests/test-encoding-align.t
> +++ b/tests/test-encoding-align.t
> @@ -4,7 +4,7 @@ Test alignment of multibyte characters
>   $ 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
> diff --git a/tests/test-encoding.t b/tests/test-encoding.t
> --- a/tests/test-encoding.t
> +++ b/tests/test-encoding.t
> @@ -13,7 +13,7 @@ we need a repo with some legacy latin-1 
>   (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()
> diff --git a/tests/test-extension.t b/tests/test-extension.t
> --- a/tests/test-extension.t
> +++ b/tests/test-extension.t
> @@ -118,7 +118,7 @@ Check hgweb's load order of extensions a
>> 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
> diff --git a/tests/test-help.t b/tests/test-help.t
> --- a/tests/test-help.t
> +++ b/tests/test-help.t
> @@ -1646,7 +1646,7 @@ 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
> @@ -1680,7 +1680,7 @@ such str.lower().
>> ambiguous = ./ambiguous.py
>> EOF
> 
> -  $ python <<EOF | sh
> +  $ $PYTHON <<EOF | sh
>> upper = "\x8bL\x98^"
>> print "hg --encoding cp932 help -e ambiguous.%s" % upper
>> EOF
> @@ -1690,7 +1690,7 @@ such str.lower().
>   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
> diff --git a/tests/test-hgweb-commands.t b/tests/test-hgweb-commands.t
> --- a/tests/test-hgweb-commands.t
> +++ b/tests/test-hgweb-commands.t
> @@ -2265,7 +2265,7 @@ bookmarks view doesn't choke on bookmark
>   $ . "$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)
> @@ -2274,7 +2274,7 @@ 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)
> @@ -2284,7 +2284,7 @@ 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)
> 
> @@ -2292,7 +2292,7 @@ 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)
> 
> @@ -2303,7 +2303,7 @@ proper status for filtered revision
> 
>   $ 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)
> @@ -2317,7 +2317,7 @@ proper status for filtered revision
> 
>   $ 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)
> @@ -2345,11 +2345,11 @@ filtered '0' changeset
>   $ 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)
> diff --git a/tests/test-histedit-arguments.t b/tests/test-histedit-arguments.t
> --- a/tests/test-histedit-arguments.t
> +++ b/tests/test-histedit-arguments.t
> @@ -279,7 +279,7 @@ short hash. This tests issue3893.
> 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
> diff --git a/tests/test-imports-checker.t b/tests/test-imports-checker.t
> --- a/tests/test-imports-checker.t
> +++ b/tests/test-imports-checker.t
> @@ -8,7 +8,7 @@ Run the doctests from the import checker
> 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
> 
> diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t
> --- a/tests/test-largefiles.t
> +++ b/tests/test-largefiles.t
> @@ -225,7 +225,7 @@ Test largefiles can be loaded in hgweb (
>   $ . "$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.
> diff --git a/tests/test-log.t b/tests/test-log.t
> --- a/tests/test-log.t
> +++ b/tests/test-log.t
> @@ -1788,7 +1788,7 @@ test -u/-k for problematic encoding
>   $ hg init problematicencoding
>   $ cd problematicencoding
> 
> -  $ python > setup.sh <<EOF
> +  $ $PYTHON > setup.sh <<EOF
>> print u'''
>> echo a > text
>> hg add text
> @@ -1804,7 +1804,7 @@ test -u/-k for problematic encoding
>   $ 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 ====
> diff --git a/tests/test-mq.t b/tests/test-mq.t
> --- a/tests/test-mq.t
> +++ b/tests/test-mq.t
> @@ -1584,7 +1584,7 @@ Test that secret mq patch does not break
>   $ 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 ..
> diff --git a/tests/test-newcgi.t b/tests/test-newcgi.t
> --- a/tests/test-newcgi.t
> +++ b/tests/test-newcgi.t
> @@ -52,15 +52,15 @@ before d74fc8dec2b4 still work.
>   $ 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]
> diff --git a/tests/test-newercgi.t b/tests/test-newercgi.t
> --- a/tests/test-newercgi.t
> +++ b/tests/test-newercgi.t
> @@ -46,15 +46,15 @@ This is a rudimentary test of the CGI fi
>   $ 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]
> diff --git a/tests/test-oldcgi.t b/tests/test-oldcgi.t
> --- a/tests/test-oldcgi.t
> +++ b/tests/test-oldcgi.t
> @@ -62,15 +62,15 @@ This tests if CGI files from before d0db
>   $ 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]
> diff --git a/tests/test-parseindex.t b/tests/test-parseindex.t
> --- a/tests/test-parseindex.t
> +++ b/tests/test-parseindex.t
> @@ -66,7 +66,7 @@ Test SEGV caused by bad revision passed 
> 
>   $ cd a
> 
> -  $ python <<EOF
> +  $ $PYTHON <<EOF
>> from mercurial import changelog, vfs
>> cl = changelog.changelog(vfs.vfs('.hg/store'))
>> print 'good heads:'
> @@ -128,7 +128,7 @@ Test corrupted p1/p2 fields that could c
>   $ 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
> diff --git a/tests/test-purge.t b/tests/test-purge.t
> --- a/tests/test-purge.t
> +++ b/tests/test-purge.t
> @@ -49,7 +49,7 @@ 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)
> diff --git a/tests/test-push-cgi.t b/tests/test-push-cgi.t
> --- a/tests/test-push-cgi.t
> +++ b/tests/test-push-cgi.t
> @@ -38,7 +38,7 @@ test preparation
> 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)
> @@ -50,7 +50,7 @@ expect failure because heads doesn't mat
> 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)
> @@ -65,7 +65,7 @@ successful force push
> 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)
> @@ -80,7 +80,7 @@ successful push, list of heads
> 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)
> diff --git a/tests/test-push-race.t b/tests/test-push-race.t
> --- a/tests/test-push-race.t
> +++ b/tests/test-push-race.t
> @@ -91,7 +91,7 @@ A set of extension and shell functions e
> 
>   $ cat >> $HGRCPATH << EOF
>> [ui]
> -  > ssh = python "$TESTDIR/dummyssh"
> +  > ssh = $PYTHON "$TESTDIR/dummyssh"
>> # simplify output
>> logtemplate = {node|short} {desc} ({branch})
>> [phases]
> diff --git a/tests/test-revset.t b/tests/test-revset.t
> --- a/tests/test-revset.t
> +++ b/tests/test-revset.t
> @@ -4180,7 +4180,7 @@ test author/desc/keyword in problematic 
>   $ hg init problematicencoding
>   $ cd problematicencoding
> 
> -  $ python > setup.sh <<EOF
> +  $ $PYTHON > setup.sh <<EOF
>> print u'''
>> echo a > text
>> hg add text
> @@ -4196,7 +4196,7 @@ test author/desc/keyword in problematic 
>   $ 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 ====
> diff --git a/tests/test-ssh-bundle1.t b/tests/test-ssh-bundle1.t
> --- a/tests/test-ssh-bundle1.t
> +++ b/tests/test-ssh-bundle1.t
> @@ -145,7 +145,7 @@ 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
> 
> @@ -272,7 +272,7 @@ a bad, evil hook that prints to stdout
>> 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
> 
> @@ -363,7 +363,7 @@ parameters:
>> 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"
> @@ -379,7 +379,7 @@ parameters:
>   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]
> 
> @@ -391,7 +391,7 @@ Test hg-ssh in read-only mode:
>> 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
> @@ -440,7 +440,7 @@ stderr from remote commands should be pr
>> [paths]
>> default-push = ssh://user@dummy/remote
>> [ui]
> -  > ssh = python "$TESTDIR/dummyssh"
> +  > ssh = $PYTHON "$TESTDIR/dummyssh"
>> [extensions]
>> localwrite = localwrite.py
>> EOF
> @@ -461,7 +461,7 @@ 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
> diff --git a/tests/test-ssh.t b/tests/test-ssh.t
> --- a/tests/test-ssh.t
> +++ b/tests/test-ssh.t
> @@ -139,7 +139,7 @@ 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
> 
> @@ -273,7 +273,7 @@ a bad, evil hook that prints to stdout
> 
>   $ 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
> @@ -380,7 +380,7 @@ parameters:
>> 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"
> @@ -396,7 +396,7 @@ parameters:
>   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]
> 
> @@ -408,7 +408,7 @@ Test hg-ssh in read-only mode:
>> 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
> @@ -455,7 +455,7 @@ stderr from remote commands should be pr
>> [paths]
>> default-push = ssh://user@dummy/remote
>> [ui]
> -  > ssh = python "$TESTDIR/dummyssh"
> +  > ssh = $PYTHON "$TESTDIR/dummyssh"
>> [extensions]
>> localwrite = localwrite.py
>> EOF
> @@ -477,7 +477,7 @@ 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
> diff --git a/tests/test-tag.t b/tests/test-tag.t
> --- a/tests/test-tag.t
> +++ b/tests/test-tag.t
> @@ -230,7 +230,7 @@ cloning local tags
> 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
> @@ -242,7 +242,7 @@ doesn't end with EOL
>   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
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Jun Wu - June 30, 2017, 2:07 a.m.
Excerpts from Augie Fackler's message of 2017-06-29 16:18:57 -0400:
> > On Jun 29, 2017, at 16:17, Augie Fackler <raf@durin42.com> wrote:
> > 
> > # HG changeset patch
> > # User Augie Fackler <augie@google.com>
> > # Date 1497993027 14400
> > #      Tue Jun 20 17:10:27 2017 -0400
> > # Node ID 298f967da627a90149e823cf9ae11fc503029d9f
> > # Parent  8238b8e8920aee16caa57b97aef8bc988559c67b
> > tests: replace yet more calls to `python` with $PYTHON
> > 
> > Summary: These are some simple cases. More to come in a future change.
> > 
> > Reviewers: krbullock
> > 
> > Differential Revision: https://hg-phab.durin42.com/D4 
> 
> I've mailed these patches here, but they're also in the experimental
> phabricator we've set up. I figured I'd use these patches (and some
> subsequent ones I've got) as test candidates since they're the exact kind
> of change that's a ton easier in phabricator.
> 
> (We'll make a bigger email about phabricator with details on the
> experiment once we get the kinks worked out.)

The patches look straightforward to me.

On Phabricator, I guess we need an "hg email" like tool to send patches to
Phabricator. The default "arc diff" behavior does not fit our use-case.
Since I'm a bit familiar with Phabricator, I can write one in contrib/.
Augie Fackler - June 30, 2017, 2:08 a.m.
> On Jun 29, 2017, at 10:07 PM, Jun Wu <quark@fb.com> wrote:
> 
> Excerpts from Augie Fackler's message of 2017-06-29 16:18:57 -0400:
>>> On Jun 29, 2017, at 16:17, Augie Fackler <raf@durin42.com> wrote:
>>> 
>>> # HG changeset patch
>>> # User Augie Fackler <augie@google.com>
>>> # Date 1497993027 14400
>>> #      Tue Jun 20 17:10:27 2017 -0400
>>> # Node ID 298f967da627a90149e823cf9ae11fc503029d9f
>>> # Parent  8238b8e8920aee16caa57b97aef8bc988559c67b
>>> tests: replace yet more calls to `python` with $PYTHON
>>> 
>>> Summary: These are some simple cases. More to come in a future change.
>>> 
>>> Reviewers: krbullock
>>> 
>>> Differential Revision: https://hg-phab.durin42.com/D4 
>> 
>> I've mailed these patches here, but they're also in the experimental
>> phabricator we've set up. I figured I'd use these patches (and some
>> subsequent ones I've got) as test candidates since they're the exact kind
>> of change that's a ton easier in phabricator.
>> 
>> (We'll make a bigger email about phabricator with details on the
>> experiment once we get the kinks worked out.)
> 
> The patches look straightforward to me.
> 
> On Phabricator, I guess we need an "hg email" like tool to send patches to
> Phabricator. The default "arc diff" behavior does not fit our use-case.
> Since I'm a bit familiar with Phabricator, I can write one in contrib/.

Yeah.

We also need a way to land patches out of phabricator, which I think might take some doing.
Jun Wu - June 30, 2017, 2:11 a.m.
Excerpts from Augie Fackler's message of 2017-06-29 22:08:41 -0400:
> Yeah.
> 
> We also need a way to land patches out of phabricator, which I think might
> take some doing.

Phabricator has "RAW patch" feature. Might be just one API call and it
returns plain text patches suitable for "hg import". I can make that work
too.

Patch

diff --git a/tests/test-bundle2-pushback.t b/tests/test-bundle2-pushback.t
--- a/tests/test-bundle2-pushback.t
+++ b/tests/test-bundle2-pushback.t
@@ -25,7 +25,7 @@ 
 
   $ cat >> $HGRCPATH <<EOF
   > [ui]
-  > ssh = python "$TESTDIR/dummyssh"
+  > ssh = $PYTHON "$TESTDIR/dummyssh"
   > username = nobody <no.reply@example.com>
   > 
   > [alias]
diff --git a/tests/test-check-module-imports.t b/tests/test-check-module-imports.t
--- a/tests/test-check-module-imports.t
+++ b/tests/test-check-module-imports.t
@@ -37,4 +37,4 @@  outputs, which should be fixed later.
   > -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" -
diff --git a/tests/test-clone-cgi.t b/tests/test-clone-cgi.t
--- a/tests/test-clone-cgi.t
+++ b/tests/test-clone-cgi.t
@@ -26,13 +26,13 @@  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)
diff --git a/tests/test-command-template.t b/tests/test-command-template.t
--- a/tests/test-command-template.t
+++ b/tests/test-command-template.t
@@ -4253,7 +4253,7 @@  Set up repository for non-ascii encoding
 
   $ hg init nonascii
   $ cd nonascii
-  $ python <<EOF
+  $ $PYTHON <<EOF
   > open('latin1', 'w').write('\xe9')
   > open('utf-8', 'w').write('\xc3\xa9')
   > EOF
diff --git a/tests/test-commit-interactive-curses.t b/tests/test-commit-interactive-curses.t
--- a/tests/test-commit-interactive-curses.t
+++ b/tests/test-commit-interactive-curses.t
@@ -342,7 +342,7 @@  Check ui.interface logic for the chunkse
 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")
diff --git a/tests/test-conflict.t b/tests/test-conflict.t
--- a/tests/test-conflict.t
+++ b/tests/test-conflict.t
@@ -120,7 +120,7 @@  Verify line splitting of custom conflict
 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
diff --git a/tests/test-contrib.t b/tests/test-contrib.t
--- a/tests/test-contrib.t
+++ b/tests/test-contrib.t
@@ -26,7 +26,7 @@  Prepare repo-a:
 
 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
@@ -58,14 +58,14 @@  Dumping revlog of file a to stdout:
 
 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
@@ -115,7 +115,7 @@  Test simplemerge command:
 
 changing local directly
 
-  $ python simplemerge local base other && echo "merge succeeded"
+  $ $PYTHON simplemerge local base other && echo "merge succeeded"
   merge succeeded
   $ cat local
   local
@@ -125,7 +125,7 @@  changing local directly
 
 printing to stdout
 
-  $ python simplemerge -p local base other
+  $ $PYTHON simplemerge -p local base other
   local
   base
   other
@@ -144,7 +144,7 @@  conflicts
   $ 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
@@ -156,7 +156,7 @@  conflicts
 
 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
@@ -168,7 +168,7 @@  1 label
 
 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
@@ -180,7 +180,7 @@  2 labels
 
 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
@@ -194,7 +194,7 @@  3 labels
 
 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]
 
@@ -202,13 +202,13 @@  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
@@ -216,7 +216,7 @@  binary file --text
 
 help
 
-  $ python simplemerge --help
+  $ $PYTHON simplemerge --help
   simplemerge [OPTS] LOCAL BASE OTHER
   
       Simple three-way file merge utility with a minimal feature set.
@@ -235,7 +235,7 @@  help
 
 wrong number of arguments
 
-  $ python simplemerge
+  $ $PYTHON simplemerge
   simplemerge: wrong number of arguments
   simplemerge [OPTS] LOCAL BASE OTHER
   
@@ -256,7 +256,7 @@  wrong number of arguments
 
 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
   
diff --git a/tests/test-encoding-align.t b/tests/test-encoding-align.t
--- a/tests/test-encoding-align.t
+++ b/tests/test-encoding-align.t
@@ -4,7 +4,7 @@  Test alignment of multibyte characters
   $ 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
diff --git a/tests/test-encoding.t b/tests/test-encoding.t
--- a/tests/test-encoding.t
+++ b/tests/test-encoding.t
@@ -13,7 +13,7 @@  we need a repo with some legacy latin-1 
   (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()
diff --git a/tests/test-extension.t b/tests/test-extension.t
--- a/tests/test-extension.t
+++ b/tests/test-extension.t
@@ -118,7 +118,7 @@  Check hgweb's load order of extensions a
   > 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
diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -1646,7 +1646,7 @@  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
@@ -1680,7 +1680,7 @@  such str.lower().
   > ambiguous = ./ambiguous.py
   > EOF
 
-  $ python <<EOF | sh
+  $ $PYTHON <<EOF | sh
   > upper = "\x8bL\x98^"
   > print "hg --encoding cp932 help -e ambiguous.%s" % upper
   > EOF
@@ -1690,7 +1690,7 @@  such str.lower().
   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
diff --git a/tests/test-hgweb-commands.t b/tests/test-hgweb-commands.t
--- a/tests/test-hgweb-commands.t
+++ b/tests/test-hgweb-commands.t
@@ -2265,7 +2265,7 @@  bookmarks view doesn't choke on bookmark
   $ . "$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)
@@ -2274,7 +2274,7 @@  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)
@@ -2284,7 +2284,7 @@  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)
 
@@ -2292,7 +2292,7 @@  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)
 
@@ -2303,7 +2303,7 @@  proper status for filtered revision
 
   $ 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)
@@ -2317,7 +2317,7 @@  proper status for filtered revision
 
   $ 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)
@@ -2345,11 +2345,11 @@  filtered '0' changeset
   $ 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)
diff --git a/tests/test-histedit-arguments.t b/tests/test-histedit-arguments.t
--- a/tests/test-histedit-arguments.t
+++ b/tests/test-histedit-arguments.t
@@ -279,7 +279,7 @@  short hash. This tests issue3893.
 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
diff --git a/tests/test-imports-checker.t b/tests/test-imports-checker.t
--- a/tests/test-imports-checker.t
+++ b/tests/test-imports-checker.t
@@ -8,7 +8,7 @@  Run the doctests from the import checker
 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
 
diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t
--- a/tests/test-largefiles.t
+++ b/tests/test-largefiles.t
@@ -225,7 +225,7 @@  Test largefiles can be loaded in hgweb (
   $ . "$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.
diff --git a/tests/test-log.t b/tests/test-log.t
--- a/tests/test-log.t
+++ b/tests/test-log.t
@@ -1788,7 +1788,7 @@  test -u/-k for problematic encoding
   $ hg init problematicencoding
   $ cd problematicencoding
 
-  $ python > setup.sh <<EOF
+  $ $PYTHON > setup.sh <<EOF
   > print u'''
   > echo a > text
   > hg add text
@@ -1804,7 +1804,7 @@  test -u/-k for problematic encoding
   $ 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 ====
diff --git a/tests/test-mq.t b/tests/test-mq.t
--- a/tests/test-mq.t
+++ b/tests/test-mq.t
@@ -1584,7 +1584,7 @@  Test that secret mq patch does not break
   $ 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 ..
diff --git a/tests/test-newcgi.t b/tests/test-newcgi.t
--- a/tests/test-newcgi.t
+++ b/tests/test-newcgi.t
@@ -52,15 +52,15 @@  before d74fc8dec2b4 still work.
   $ 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]
diff --git a/tests/test-newercgi.t b/tests/test-newercgi.t
--- a/tests/test-newercgi.t
+++ b/tests/test-newercgi.t
@@ -46,15 +46,15 @@  This is a rudimentary test of the CGI fi
   $ 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]
diff --git a/tests/test-oldcgi.t b/tests/test-oldcgi.t
--- a/tests/test-oldcgi.t
+++ b/tests/test-oldcgi.t
@@ -62,15 +62,15 @@  This tests if CGI files from before d0db
   $ 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]
diff --git a/tests/test-parseindex.t b/tests/test-parseindex.t
--- a/tests/test-parseindex.t
+++ b/tests/test-parseindex.t
@@ -66,7 +66,7 @@  Test SEGV caused by bad revision passed 
 
   $ cd a
 
-  $ python <<EOF
+  $ $PYTHON <<EOF
   > from mercurial import changelog, vfs
   > cl = changelog.changelog(vfs.vfs('.hg/store'))
   > print 'good heads:'
@@ -128,7 +128,7 @@  Test corrupted p1/p2 fields that could c
   $ 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
diff --git a/tests/test-purge.t b/tests/test-purge.t
--- a/tests/test-purge.t
+++ b/tests/test-purge.t
@@ -49,7 +49,7 @@  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)
diff --git a/tests/test-push-cgi.t b/tests/test-push-cgi.t
--- a/tests/test-push-cgi.t
+++ b/tests/test-push-cgi.t
@@ -38,7 +38,7 @@  test preparation
 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)
@@ -50,7 +50,7 @@  expect failure because heads doesn't mat
 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)
@@ -65,7 +65,7 @@  successful force push
 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)
@@ -80,7 +80,7 @@  successful push, list of heads
 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)
diff --git a/tests/test-push-race.t b/tests/test-push-race.t
--- a/tests/test-push-race.t
+++ b/tests/test-push-race.t
@@ -91,7 +91,7 @@  A set of extension and shell functions e
 
   $ cat >> $HGRCPATH << EOF
   > [ui]
-  > ssh = python "$TESTDIR/dummyssh"
+  > ssh = $PYTHON "$TESTDIR/dummyssh"
   > # simplify output
   > logtemplate = {node|short} {desc} ({branch})
   > [phases]
diff --git a/tests/test-revset.t b/tests/test-revset.t
--- a/tests/test-revset.t
+++ b/tests/test-revset.t
@@ -4180,7 +4180,7 @@  test author/desc/keyword in problematic 
   $ hg init problematicencoding
   $ cd problematicencoding
 
-  $ python > setup.sh <<EOF
+  $ $PYTHON > setup.sh <<EOF
   > print u'''
   > echo a > text
   > hg add text
@@ -4196,7 +4196,7 @@  test author/desc/keyword in problematic 
   $ 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 ====
diff --git a/tests/test-ssh-bundle1.t b/tests/test-ssh-bundle1.t
--- a/tests/test-ssh-bundle1.t
+++ b/tests/test-ssh-bundle1.t
@@ -145,7 +145,7 @@  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
 
@@ -272,7 +272,7 @@  a bad, evil hook that prints to stdout
   > 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
 
@@ -363,7 +363,7 @@  parameters:
   > 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"
@@ -379,7 +379,7 @@  parameters:
   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]
 
@@ -391,7 +391,7 @@  Test hg-ssh in read-only mode:
   > 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
@@ -440,7 +440,7 @@  stderr from remote commands should be pr
   > [paths]
   > default-push = ssh://user@dummy/remote
   > [ui]
-  > ssh = python "$TESTDIR/dummyssh"
+  > ssh = $PYTHON "$TESTDIR/dummyssh"
   > [extensions]
   > localwrite = localwrite.py
   > EOF
@@ -461,7 +461,7 @@  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
diff --git a/tests/test-ssh.t b/tests/test-ssh.t
--- a/tests/test-ssh.t
+++ b/tests/test-ssh.t
@@ -139,7 +139,7 @@  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
 
@@ -273,7 +273,7 @@  a bad, evil hook that prints to stdout
 
   $ 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
@@ -380,7 +380,7 @@  parameters:
   > 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"
@@ -396,7 +396,7 @@  parameters:
   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]
 
@@ -408,7 +408,7 @@  Test hg-ssh in read-only mode:
   > 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
@@ -455,7 +455,7 @@  stderr from remote commands should be pr
   > [paths]
   > default-push = ssh://user@dummy/remote
   > [ui]
-  > ssh = python "$TESTDIR/dummyssh"
+  > ssh = $PYTHON "$TESTDIR/dummyssh"
   > [extensions]
   > localwrite = localwrite.py
   > EOF
@@ -477,7 +477,7 @@  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
diff --git a/tests/test-tag.t b/tests/test-tag.t
--- a/tests/test-tag.t
+++ b/tests/test-tag.t
@@ -230,7 +230,7 @@  cloning local tags
 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
@@ -242,7 +242,7 @@  doesn't end with EOL
   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