From: Tomi Ollila Date: Sun, 2 Aug 2015 08:31:19 +0000 (+0300) Subject: Re: [PATCH] test: use the python interpreter in sh.config X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=acf223a126697a9fcf049a9927743f8137f662de;p=notmuch-archives.git Re: [PATCH] test: use the python interpreter in sh.config --- diff --git a/84/64f3a6d1dfe4322992d539965a0c9a6a9d6aae b/84/64f3a6d1dfe4322992d539965a0c9a6a9d6aae new file mode 100644 index 000000000..435c83f35 --- /dev/null +++ b/84/64f3a6d1dfe4322992d539965a0c9a6a9d6aae @@ -0,0 +1,153 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id 534926DE1781 + for ; Sun, 2 Aug 2015 01:31:40 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: 0.926 +X-Spam-Level: +X-Spam-Status: No, score=0.926 tagged_above=-999 required=5 tests=[AWL=0.274, + SPF_NEUTRAL=0.652] 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 xYQSHlZD6aXU for ; + Sun, 2 Aug 2015 01:31:37 -0700 (PDT) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by arlo.cworth.org (Postfix) with ESMTP id 5C6246DE177D + for ; Sun, 2 Aug 2015 01:31:36 -0700 (PDT) +Received: from guru.guru-group.fi (localhost [IPv6:::1]) + by guru.guru-group.fi (Postfix) with ESMTP id AE417100046; + Sun, 2 Aug 2015 11:31:19 +0300 (EEST) +From: Tomi Ollila +To: David Bremner , David Bremner , + notmuch@notmuchmail.org +Subject: Re: [PATCH] test: use the python interpreter in sh.config +In-Reply-To: <1438497655-15446-1-git-send-email-david@tethera.net> +References: <87mw0agsp7.fsf@maritornes.cs.unb.ca> + <1438497655-15446-1-git-send-email-david@tethera.net> +User-Agent: Notmuch/0.20.2+31~g967a7a3 (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-unknown-linux-gnu) +X-Face: HhBM'cA~ +MIME-Version: 1.0 +Content-Type: text/plain +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: Sun, 02 Aug 2015 08:31:40 -0000 + +On Sun, Aug 02 2015, David Bremner wrote: + +> The configure script chooses "python" if both python and python{2,3} +> exist exists, so this could change the version of python used to run +> the test suite. + +LGTM. tests pass. + +> +> The checking for ${NOTMUCH_PYTHON} in the test suite is arguably +> over-engineering, since the configure step will fail if it can't find +> it. + +Unless we accidentally edit NOTMUCH_PYTHON (away) in configure... +(i.e. I parsonally think this comment part is unnecessary, but i'm not +against having it) + +Tomi + +> --- +> +> Here is an updated version which fixes the subject typo, and actually +> tests for the python binary read from sh.config. I'll probably merge this version unless there are objections +> +> configure | 2 ++ +> test/T390-python.sh | 2 ++ +> test/test-lib.sh | 15 ++++----------- +> 3 files changed, 8 insertions(+), 11 deletions(-) +> +> diff --git a/configure b/configure +> index 56f550b..20fbed6 100755 +> --- a/configure +> +++ b/configure +> @@ -114,6 +114,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/T390-python.sh b/test/T390-python.sh +> index 26d0b97..c3f24f7 100755 +> --- a/test/T390-python.sh +> +++ b/test/T390-python.sh +> @@ -2,6 +2,8 @@ +> test_description="python bindings" +> . ./test-lib.sh +> +> +test_require_external_prereq ${NOTMUCH_PYTHON} +> + +> add_email_corpus +> +> test_begin_subtest "compare thread ids" +> diff --git a/test/test-lib.sh b/test/test-lib.sh +> index 3466e9c..db3b6aa 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_ruby() { +> @@ -1325,5 +1319,4 @@ 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 +> +test_declare_external_prereq ${NOTMUCH_PYTHON} +> -- +> 2.1.4 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch