diff --git a/tests/test-parseindex2.py b/tests/test-parseindex2.py
index e0dbfbd4062c72fa60958397d19fe350d6a0ebce_dGVzdHMvdGVzdC1wYXJzZWluZGV4Mi5weQ==..e7a4c018b563782b4b10cc8a687405312d67d7cb_dGVzdHMvdGVzdC1wYXJzZWluZGV4Mi5weQ== 100644
--- a/tests/test-parseindex2.py
+++ b/tests/test-parseindex2.py
@@ -5,6 +5,7 @@
 
 from __future__ import absolute_import, print_function
 
+import os
 import struct
 import subprocess
 import sys
@@ -129,7 +130,7 @@
         "import sys; sys.hexversion=%s; "
         "import mercurial.cext.parsers" % hexversion
     )
-    cmd = "python -c \"%s\"" % code
+    cmd = "\"%s\" -c \"%s\"" % (os.environ['PYTHON'], code)
     # We need to do these tests inside a subprocess because parser.c's
     # version-checking code happens inside the module init function, and
     # when using reload() to reimport an extension module, "The init function