[PATCH] test: add tests for python bindings
[notmuch-archives.git] / ee / 77a70d6c56a3780ef62db6d50d99fefcfc9e13
1 Return-Path: <bremner@tethera.net>\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 6B9D3429E25\r
6         for <notmuch@notmuchmail.org>; Mon,  5 Dec 2011 14:11:21 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -2.3\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id GEDbIp0NdIXF for <notmuch@notmuchmail.org>;\r
16         Mon,  5 Dec 2011 14:11:21 -0800 (PST)\r
17 Received: from tempo.its.unb.ca (tempo.its.unb.ca [131.202.1.21])\r
18         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id DADB1431FB6\r
21         for <notmuch@notmuchmail.org>; Mon,  5 Dec 2011 14:11:20 -0800 (PST)\r
22 Received: from zancas.localnet\r
23         (fctnnbsc36w-156034079193.pppoe-dynamic.High-Speed.nb.bellaliant.net\r
24         [156.34.79.193]) (authenticated bits=0)\r
25         by tempo.its.unb.ca (8.13.8/8.13.8) with ESMTP id pB5MBDgX030511\r
26         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO);\r
27         Mon, 5 Dec 2011 18:11:16 -0400\r
28 Received: from bremner by zancas.localnet with local (Exim 4.77)\r
29         (envelope-from <bremner@tethera.net>)\r
30         id 1RXgkj-0003sv-DV; Mon, 05 Dec 2011 18:11:13 -0400\r
31 From: David Bremner <david@tethera.net>\r
32 To: notmuch@notmuchmail.org\r
33 Subject: [PATCH] test: add tests for python bindings\r
34 Date: Mon,  5 Dec 2011 18:11:06 -0400\r
35 Message-Id: <1323123066-14890-1-git-send-email-david@tethera.net>\r
36 X-Mailer: git-send-email 1.7.7.3\r
37 In-Reply-To: <1323050068-28544-1-git-send-email-david@tethera.net>\r
38 References: <1323050068-28544-1-git-send-email-david@tethera.net>\r
39 Cc: David Bremner <bremner@debian.org>\r
40 X-BeenThere: notmuch@notmuchmail.org\r
41 X-Mailman-Version: 2.1.13\r
42 Precedence: list\r
43 List-Id: "Use and development of the notmuch mail system."\r
44         <notmuch.notmuchmail.org>\r
45 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
46         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
47 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
48 List-Post: <mailto:notmuch@notmuchmail.org>\r
49 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
50 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
51         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
52 X-List-Received-Date: Mon, 05 Dec 2011 22:11:21 -0000\r
53 \r
54 From: David Bremner <bremner@debian.org>\r
55 \r
56 We start modestly, with a (slightly modified) test case from Kazuo\r
57 Teramoto. Originally it just made sure the bindings didn't crash; here\r
58 we check that by comparing the output with that of notmuch search.\r
59 ---\r
60 This version of the test is less ambitious, and just checks thread ids match.\r
61  test/notmuch-test |    1 +\r
62  test/python       |   17 +++++++++++++++++\r
63  2 files changed, 18 insertions(+), 0 deletions(-)\r
64  create mode 100755 test/python\r
65 \r
66 diff --git a/test/notmuch-test b/test/notmuch-test\r
67 index 5aced5c..113ea7c 100755\r
68 --- a/test/notmuch-test\r
69 +++ b/test/notmuch-test\r
70 @@ -47,6 +47,7 @@ TESTS="\r
71    symbol-hiding\r
72    search-folder-coherence\r
73    atomicity\r
74 +  python\r
75  "\r
76  TESTS=${NOTMUCH_TESTS:=$TESTS}\r
77  \r
78 diff --git a/test/python b/test/python\r
79 new file mode 100755\r
80 index 0000000..179427b\r
81 --- /dev/null\r
82 +++ b/test/python\r
83 @@ -0,0 +1,17 @@\r
84 +#!/usr/bin/env bash\r
85 +test_description="python bindings"\r
86 +. ./test-lib.sh\r
87 +\r
88 +add_email_corpus\r
89 +\r
90 +test_begin_subtest "compare thread ids"\r
91 +python <<EOF | sort > OUTPUT\r
92 +import notmuch\r
93 +db = notmuch.Database(mode=notmuch.Database.MODE.READ_WRITE)\r
94 +q_new = notmuch.Query(db, 'tag:inbox')\r
95 +for t in q_new.search_threads():\r
96 +    print t.get_thread_id()\r
97 +EOF\r
98 +notmuch search --output=threads tag:inbox | sed s/^thread:// | sort > EXPECTED\r
99 +test_expect_equal_file OUTPUT EXPECTED\r
100 +test_done\r
101 -- \r
102 1.7.7.3\r
103 \r