1 Return-Path: <dmitry.kurochkin@gmail.com>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 9EBE1429E25
\r
6 for <notmuch@notmuchmail.org>; Sun, 11 Dec 2011 06:59:03 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id FyZRhdhnvltl for <notmuch@notmuchmail.org>;
\r
17 Sun, 11 Dec 2011 06:59:03 -0800 (PST)
\r
18 Received: from mail-bw0-f53.google.com (mail-bw0-f53.google.com
\r
19 [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id D58A5431FB6
\r
22 for <notmuch@notmuchmail.org>; Sun, 11 Dec 2011 06:59:02 -0800 (PST)
\r
23 Received: by bkat8 with SMTP id t8so4842863bka.26
\r
24 for <notmuch@notmuchmail.org>; Sun, 11 Dec 2011 06:59:00 -0800 (PST)
\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
\r
26 h=from:to:subject:in-reply-to:references:user-agent:date:message-id
\r
27 :mime-version:content-type;
\r
28 bh=BHpkqXPDVP8+hDbYWcALD73WoyhbID8PUBAmUrj/Ul0=;
\r
29 b=Tr6M0Yf07L1pd0ZCBoJcS/PvAv70qcAHEYXF0kzwFha2+GyR2PqES5Tt1ToaEJtwDQ
\r
30 6d/pBRIATdyxg6k5x6OsgZcxuOjWoOtGUQbDQYWEPe/d2Qqz3Ff8MG9VNuPqoXDtDPBi
\r
31 6Wpk6DBJSOH2r2NDLM8MPXDyslcFWCK/PihSY=
\r
32 Received: by 10.205.129.148 with SMTP id hi20mr7690377bkc.25.1323615533347;
\r
33 Sun, 11 Dec 2011 06:58:53 -0800 (PST)
\r
34 Received: from localhost ([91.144.186.21])
\r
35 by mx.google.com with ESMTPS id h7sm24330889bkw.12.2011.12.11.06.58.52
\r
36 (version=TLSv1/SSLv3 cipher=OTHER);
\r
37 Sun, 11 Dec 2011 06:58:52 -0800 (PST)
\r
38 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
\r
39 To: Thomas Jost <schnouki@schnouki.net>, notmuch@notmuchmail.org
\r
40 Subject: Re: [PATCH 1/2] test: add a function to run Python tests
\r
41 In-Reply-To: <1323251178-20409-1-git-send-email-schnouki@schnouki.net>
\r
42 References: <1323251178-20409-1-git-send-email-schnouki@schnouki.net>
\r
43 User-Agent: Notmuch/0.10.2+82~g96a629c (http://notmuchmail.org) Emacs/23.3.1
\r
44 (x86_64-pc-linux-gnu)
\r
45 Date: Sun, 11 Dec 2011 18:58:18 +0400
\r
46 Message-ID: <877h236tpx.fsf@gmail.com>
\r
48 Content-Type: text/plain; charset=us-ascii
\r
49 X-BeenThere: notmuch@notmuchmail.org
\r
50 X-Mailman-Version: 2.1.13
\r
52 List-Id: "Use and development of the notmuch mail system."
\r
53 <notmuch.notmuchmail.org>
\r
54 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
55 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
56 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
57 List-Post: <mailto:notmuch@notmuchmail.org>
\r
58 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
59 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
60 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
61 X-List-Received-Date: Sun, 11 Dec 2011 14:59:03 -0000
\r
65 On Wed, 7 Dec 2011 10:46:17 +0100, Thomas Jost <schnouki@schnouki.net> wrote:
\r
66 > The new test_python() function makes writing Python tests a little easier:
\r
67 > - it sets the environment variables as needed
\r
68 > - it redirects stdout to the OUTPUT file (like test_emacs()).
\r
70 > This commit also declares python as an external prereq.
\r
72 > The stdout redirection is required to avoid trouble when running commands like
\r
73 > "python 'script' | sort > OUTPUT": in such a case, any error due to a missing
\r
74 > external prereq would be "swallowed" by sort, resulting to a failed test instead
\r
77 > test/python | 6 ++----
\r
78 > test/test-lib.sh | 9 +++++++++
\r
79 > 2 files changed, 11 insertions(+), 4 deletions(-)
\r
81 > diff --git a/test/python b/test/python
\r
82 > index f737749..c3aa726 100755
\r
85 > @@ -5,9 +5,7 @@ test_description="python bindings"
\r
88 > test_begin_subtest "compare thread ids"
\r
89 > -LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib \
\r
90 > -PYTHONPATH=$TEST_DIRECTORY/../bindings/python \
\r
91 > -python <<EOF | sort > OUTPUT
\r
92 > +test_python <<EOF
\r
94 > db = notmuch.Database(mode=notmuch.Database.MODE.READ_WRITE)
\r
95 > q_new = notmuch.Query(db, 'tag:inbox')
\r
96 > @@ -15,5 +13,5 @@ for t in q_new.search_threads():
\r
97 > print t.get_thread_id()
\r
99 > notmuch search --output=threads tag:inbox | sed s/^thread:// | sort > EXPECTED
\r
100 > -test_expect_equal_file OUTPUT EXPECTED
\r
101 > +test_expect_equal_file <(sort OUTPUT) EXPECTED
\r
103 > diff --git a/test/test-lib.sh b/test/test-lib.sh
\r
104 > index a975957..519bd84 100644
\r
105 > --- a/test/test-lib.sh
\r
106 > +++ b/test/test-lib.sh
\r
107 > @@ -919,6 +919,14 @@ test_emacs () {
\r
108 > emacsclient --socket-name="$EMACS_SERVER" --eval "(progn $@)"
\r
112 > + export LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib
\r
113 > + export PYTHONPATH=$TEST_DIRECTORY/../bindings/python
\r
115 > + (echo "import sys; _orig_stdout=sys.stdout; sys.stdout=open('OUTPUT', 'w')"; cat) \
\r
118 Perhaps we should have a test-lib.py for test-specific stuff like this
\r
119 (similar to test-lib.el)? I think it would be cleaner and makes it easy
\r
120 to add more Python test auxiliary functions later.
\r
127 > test_reset_state_ () {
\r
128 > test -z "$test_init_done_" && test_init_
\r
130 > @@ -1148,3 +1156,4 @@ test_declare_external_prereq emacs
\r
131 > test_declare_external_prereq emacsclient
\r
132 > test_declare_external_prereq gdb
\r
133 > test_declare_external_prereq gpg
\r
134 > +test_declare_external_prereq python
\r
138 > _______________________________________________
\r
139 > notmuch mailing list
\r
140 > notmuch@notmuchmail.org
\r
141 > http://notmuchmail.org/mailman/listinfo/notmuch
\r