Patchwork D9730: test: replace a many occurence of `python` with `$PYTHON`

login
register
mail settings
Submitter phabricator
Date Jan. 12, 2021, 10:40 p.m.
Message ID <differential-rev-PHID-DREV-5spdoyoazsjzzmlxjuzd-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48046/
State Superseded
Headers show

Comments

phabricator - Jan. 12, 2021, 10:40 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Otherwise this can use the wrong python version, or worse, not find any python
  at all.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9730

AFFECTED FILES
  tests/library-infinitepush.sh
  tests/remotefilelog-library.sh
  tests/test-demandimport.py
  tests/test-infinitepush-ci.t
  tests/test-nointerrupt.t
  tests/test-remotefilelog-cacheprocess.t
  tests/test-update-atomic.t
  tests/test-verify-repo-operations.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/tests/test-verify-repo-operations.py b/tests/test-verify-repo-operations.py
--- a/tests/test-verify-repo-operations.py
+++ b/tests/test-verify-repo-operations.py
@@ -11,7 +11,9 @@ 
 import sys
 
 # Only run if slow tests are allowed
-if subprocess.call(['python', '%s/hghave' % os.environ['TESTDIR'], 'slow']):
+if subprocess.call(
+    [os.environ['PYTHON'], '%s/hghave' % os.environ['TESTDIR'], 'slow']
+):
     sys.exit(80)
 
 # These tests require Hypothesis and pytz to be installed.
@@ -352,7 +354,7 @@ 
             o.write(content)
         self.log.append(
             (
-                "$ python -c 'import binascii; "
+                "$ $PYTHON -c 'import binascii; "
                 "print(binascii.unhexlify(\"%s\"))' > %s"
             )
             % (
diff --git a/tests/test-update-atomic.t b/tests/test-update-atomic.t
--- a/tests/test-update-atomic.t
+++ b/tests/test-update-atomic.t
@@ -54,7 +54,7 @@ 
   $ hg update -r 1 --config extensions.showwrites=.hg/showwrites.py 2>&1 | grep "a1'.*wb"
   ('vfs open', ('a1', 'wb'), [('atomictemp', False), ('backgroundclose', True)])
 
-  $ python $TESTTMP/show_mode.py *
+  $ $PYTHON $TESTTMP/show_mode.py *
   a1:0644
   a2:0755
   b1:0644
@@ -76,7 +76,7 @@ 
   $ hg update -r 1
   6 files updated, 0 files merged, 1 files removed, 0 files unresolved
 
-  $ python $TESTTMP/show_mode.py *
+  $ $PYTHON $TESTTMP/show_mode.py *
   a1:0644
   a2:0755
   b1:0644
@@ -88,7 +88,7 @@ 
 
   $ chmod a-w ro
 
-  $ python $TESTTMP/show_mode.py ro
+  $ $PYTHON $TESTTMP/show_mode.py ro
   ro:0444
 
 Now the file is present, try to update and check the permissions of the file
@@ -96,7 +96,7 @@ 
   $ hg up -r 2
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
-  $ python $TESTTMP/show_mode.py ro
+  $ $PYTHON $TESTTMP/show_mode.py ro
   ro:0644
 
 # The file which was read-only is now writable in the default behavior
@@ -121,7 +121,7 @@ 
   C ro
 
 Check the file permission after update
-  $ python $TESTTMP/show_mode.py *
+  $ $PYTHON $TESTTMP/show_mode.py *
   a1:0644
   a2:0755
   b1:0644
@@ -133,7 +133,7 @@ 
 
   $ chmod a-w ro
 
-  $ python $TESTTMP/show_mode.py ro
+  $ $PYTHON $TESTTMP/show_mode.py ro
   ro:0444
 
 Now the file is present, try to update and check the permissions of the file
@@ -141,7 +141,7 @@ 
   $ hg update -r 2 --traceback
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
-  $ python $TESTTMP/show_mode.py ro
+  $ $PYTHON $TESTTMP/show_mode.py ro
   ro:0644
 
 # The behavior is the same as without atomic update
diff --git a/tests/test-remotefilelog-cacheprocess.t b/tests/test-remotefilelog-cacheprocess.t
--- a/tests/test-remotefilelog-cacheprocess.t
+++ b/tests/test-remotefilelog-cacheprocess.t
@@ -66,7 +66,7 @@ 
 
   $ cat >> $HGRCPATH <<EOF
   > [remotefilelog]
-  > cacheprocess = python $TESTTMP/cacheprocess-logger.py
+  > cacheprocess = $PYTHON $TESTTMP/cacheprocess-logger.py
   > EOF
 
 Test cache keys and cache misses.
diff --git a/tests/test-nointerrupt.t b/tests/test-nointerrupt.t
--- a/tests/test-nointerrupt.t
+++ b/tests/test-nointerrupt.t
@@ -59,7 +59,7 @@ 
   > EOF
 
 Test ctrl-c
-  $ python $TESTTMP/timeout.py -s INT 1 hg sleep 2
+  $ $PYTHON $TESTTMP/timeout.py -s INT 1 hg sleep 2
   interrupted!
   [124]
 
@@ -68,7 +68,7 @@ 
   > nointerrupt = yes
   > EOF
 
-  $ python $TESTTMP/timeout.py -s INT 1 hg sleep 2
+  $ $PYTHON $TESTTMP/timeout.py -s INT 1 hg sleep 2
   interrupted!
   [124]
 
@@ -77,7 +77,7 @@ 
   > nointerrupt-interactiveonly = False
   > EOF
 
-  $ python $TESTTMP/timeout.py -s INT 1 hg sleep 2
+  $ $PYTHON $TESTTMP/timeout.py -s INT 1 hg sleep 2
   shutting down cleanly
   press ^C again to terminate immediately (dangerous)
   end of unsafe operation
diff --git a/tests/test-infinitepush-ci.t b/tests/test-infinitepush-ci.t
--- a/tests/test-infinitepush-ci.t
+++ b/tests/test-infinitepush-ci.t
@@ -10,7 +10,7 @@ 
   $ . "$TESTDIR/library-infinitepush.sh"
   $ cat >> $HGRCPATH <<EOF
   > [ui]
-  > ssh = python "$TESTDIR/dummyssh"
+  > ssh = $PYTHON "$TESTDIR/dummyssh"
   > [alias]
   > glog = log -GT "{rev}:{node|short} {desc}\n{phase}"
   > EOF
diff --git a/tests/test-demandimport.py b/tests/test-demandimport.py
--- a/tests/test-demandimport.py
+++ b/tests/test-demandimport.py
@@ -14,7 +14,7 @@ 
 
 # Only run if demandimport is allowed
 if subprocess.call(
-    ['python', '%s/hghave' % os.environ['TESTDIR'], 'demandimport']
+    [os.environ['PYTHON'], '%s/hghave' % os.environ['TESTDIR'], 'demandimport']
 ):
     sys.exit(80)
 
diff --git a/tests/remotefilelog-library.sh b/tests/remotefilelog-library.sh
--- a/tests/remotefilelog-library.sh
+++ b/tests/remotefilelog-library.sh
@@ -8,7 +8,7 @@ 
 rebase=
 strip=
 [ui]
-ssh=python "$TESTDIR/dummyssh"
+ssh=$PYTHON "$TESTDIR/dummyssh"
 [server]
 preferuncompressed=True
 [experimental]
diff --git a/tests/library-infinitepush.sh b/tests/library-infinitepush.sh
--- a/tests/library-infinitepush.sh
+++ b/tests/library-infinitepush.sh
@@ -15,7 +15,7 @@ 
 [extensions]
 infinitepush=
 [ui]
-ssh = python "$TESTDIR/dummyssh"
+ssh = $PYTHON "$TESTDIR/dummyssh"
 [infinitepush]
 branchpattern=re:scratch/.*
 EOF