From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 9D0426DE15BE for ; Sat, 23 May 2015 13:30:42 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.284 X-Spam-Level: X-Spam-Status: No, score=0.284 tagged_above=-999 required=5 tests=[AWL=0.274, T_HEADER_FROM_DIFFERENT_DOMAINS=0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hfKtf6S2jyNh for ; Sat, 23 May 2015 13:30:38 -0700 (PDT) Received: from mx.xen14.node3324.gplhost.com (gitolite.debian.net [87.98.215.224]) by arlo.cworth.org (Postfix) with ESMTPS id 1BBE56DE147C for ; Sat, 23 May 2015 13:30:38 -0700 (PDT) Received: from remotemail by mx.xen14.node3324.gplhost.com with local (Exim 4.80) (envelope-from ) id 1YwG3P-0002qV-UM; Sat, 23 May 2015 20:29:55 +0000 Received: (nullmailer pid 8765 invoked by uid 1000); Sat, 23 May 2015 20:29:05 -0000 From: David Bremner 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 Message-Id: <1432412927-8373-4-git-send-email-david@tethera.net> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1432412927-8373-1-git-send-email-david@tethera.net> References: <1432412927-8373-1-git-send-email-david@tethera.net> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 May 2015 20:30:42 -0000 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