test-check-py3-compat: don't run py3 part if not build against python3
authorYuya Nishihara <yuya@tcha.org>
Sun, 02 Sep 2018 16:26:33 +0900
changeset 39402 ecbab8be7470
parent 39401 0cbcf962847e
child 39403 66b5ded95185
test-check-py3-compat: don't run py3 part if not build against python3 This test depends on C extensions built for python3, which aren't available if run-tests.py runs on python2 and no -l/--local is specified.
tests/hghave.py
tests/test-check-py3-compat.t
--- a/tests/hghave.py	Sun Sep 02 16:23:34 2018 +0900
+++ b/tests/hghave.py	Sun Sep 02 16:26:33 2018 +0900
@@ -633,16 +633,6 @@
 def has_python3exe():
     return matchoutput('python3 -V', br'^Python 3.(5|6|7|8|9)')
 
-@check("py3pygments", "Pygments available on Python 3.x")
-def has_py3pygments():
-    if has_py3k():
-        return has_pygments()
-    elif has_python3exe():
-        # just check exit status (ignoring output)
-        py3 = os.environ['PYTHON3']
-        return matchoutput('%s -c "import pygments"' % py3, br'')
-    return False
-
 @check("pure", "running with pure Python code")
 def has_pure():
     return any([
--- a/tests/test-check-py3-compat.t	Sun Sep 02 16:23:34 2018 +0900
+++ b/tests/test-check-py3-compat.t	Sun Sep 02 16:26:33 2018 +0900
@@ -24,13 +24,13 @@
   setup.py not using absolute_import
 #endif
 
-#if py3exe
+#if py3k
   $ testrepohg files 'set:(**.py) - grep(pygments)' \
   > -X hgdemandimport/demandimportpy2.py \
   > -X hgext/fsmonitor/pywatchman \
   > -X mercurial/cffi \
   > -X mercurial/thirdparty \
-  > | sed 's|\\|/|g' | xargs python3 contrib/check-py3-compat.py \
+  > | sed 's|\\|/|g' | xargs $PYTHON contrib/check-py3-compat.py \
   > | sed 's/[0-9][0-9]*)$/*)/'
   hgext/convert/transport.py: error importing: <*Error> No module named 'svn.client' (error at transport.py:*) (glob) (?)
   hgext/infinitepush/sqlindexapi.py: error importing: <*Error> No module named 'mysql' (error at sqlindexapi.py:*) (glob) (?)
@@ -40,8 +40,8 @@
 
 #endif
 
-#if py3exe py3pygments
+#if py3k pygments
   $ testrepohg files 'set:(**.py) and grep(pygments)' | sed 's|\\|/|g' \
-  > | xargs python3 contrib/check-py3-compat.py \
+  > | xargs $PYTHON contrib/check-py3-compat.py \
   > | sed 's/[0-9][0-9]*)$/*)/'
 #endif