Patchwork [2,of,3] test-check-py3-compat: don't run py3 part if not build against python3

login
register
mail settings
Submitter Yuya Nishihara
Date Sept. 2, 2018, 7:43 a.m.
Message ID <db45c60203e769d9dfae.1535874236@mimosa>
Download mbox | patch
Permalink /patch/34253/
State Accepted
Headers show

Comments

Yuya Nishihara - Sept. 2, 2018, 7:43 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1535873193 -32400
#      Sun Sep 02 16:26:33 2018 +0900
# Node ID db45c60203e769d9dfaed7fa7ac5715f8b838539
# Parent  608d6534e5fcd1d1ec32119b4f8614ce91f96871
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.

Patch

diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -633,16 +633,6 @@  def has_py3k():
 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([
diff --git a/tests/test-check-py3-compat.t b/tests/test-check-py3-compat.t
--- a/tests/test-check-py3-compat.t
+++ b/tests/test-check-py3-compat.t
@@ -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