unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Subject: [PATCH 3/4] test: use the python interpreter in sh.configure
Date: Sat, 23 May 2015 22:28:46 +0200	[thread overview]
Message-ID: <1432412927-8373-4-git-send-email-david@tethera.net> (raw)
In-Reply-To: <1432412927-8373-1-git-send-email-david@tethera.net>

The configure script chooses "python" if it exists, so this could
change the version of python used to run the test suite.
---
 configure        |  2 ++
 test/test-lib.sh | 14 +++-----------
 2 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/configure b/configure
index 71eef6c..1081061 100755
--- a/configure
+++ b/configure
@@ -111,6 +111,8 @@ Other environment variables can be used to control configure itself,
 	XAPIAN_CONFIG	The program to use to determine flags for
 			compiling and linking against the Xapian
 			library. [$XAPIAN_CONFIG]
+	PYTHON		Name of python command to use in
+			configure and the test suite.
 
 Additionally, various options can be specified on the configure
 command line.
diff --git a/test/test-lib.sh b/test/test-lib.sh
index 486d1c4..9b63a7a 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -621,9 +621,9 @@ test_expect_equal_json () {
     # The test suite forces LC_ALL=C, but this causes Python 3 to
     # decode stdin as ASCII.  We need to read JSON in UTF-8, so
     # override Python's stdio encoding defaults.
-    output=$(echo "$1" | PYTHONIOENCODING=utf-8 python -mjson.tool \
+    output=$(echo "$1" | PYTHONIOENCODING=utf-8 $NOTMUCH_PYTHON -mjson.tool \
         || echo "$1")
-    expected=$(echo "$2" | PYTHONIOENCODING=utf-8 python -mjson.tool \
+    expected=$(echo "$2" | PYTHONIOENCODING=utf-8 $NOTMUCH_PYTHON -mjson.tool \
         || echo "$2")
     shift 2
     test_expect_equal "$output" "$expected" "$@"
@@ -1153,14 +1153,8 @@ test_python() {
 	export LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib
 	export PYTHONPATH=$TEST_DIRECTORY/../bindings/python
 
-	# Some distros (e.g. Arch Linux) ship Python 2.* as /usr/bin/python2,
-	# most others as /usr/bin/python. So first try python2, and fallback to
-	# python if python2 doesn't exist.
-	cmd=python2
-	[[ ${test_missing_external_prereq_[python2]} == t ]] && cmd=python
-
 	(echo "import sys; _orig_stdout=sys.stdout; sys.stdout=open('OUTPUT', 'w')"; cat) \
-		| $cmd -
+		| $NOTMUCH_PYTHON -
 }
 
 test_C () {
@@ -1320,5 +1314,3 @@ test_declare_external_prereq emacs
 test_declare_external_prereq ${TEST_EMACSCLIENT}
 test_declare_external_prereq gdb
 test_declare_external_prereq gpg
-test_declare_external_prereq python
-test_declare_external_prereq python2
-- 
2.1.4

  parent reply	other threads:[~2015-05-23 20:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-23 20:28 Support running test suite using python3 David Bremner
2015-05-23 20:28 ` [PATCH 1/4] test: make python tests compatible with python3 David Bremner
2015-05-23 20:28 ` [PATCH 2/4] configure: add ability to force python version via environment David Bremner
2015-05-23 20:28 ` David Bremner [this message]
2015-06-08 14:50   ` [PATCH 3/4] test: use the python interpreter in sh.configure David Bremner
2015-08-02  6:40     ` [PATCH] test: use the python interpreter in sh.config David Bremner
2015-08-02  8:31       ` Tomi Ollila
2015-08-04 14:35       ` David Bremner
2015-05-23 20:28 ` [PATCH 4/4] test: redirect man output to /dev/null David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1432412927-8373-4-git-send-email-david@tethera.net \
    --to=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).