[PATCH] test: add tests for python bindings
authorDavid Bremner <david@tethera.net>
Mon, 5 Dec 2011 01:54:28 +0000 (21:54 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:40:35 +0000 (09:40 -0800)
57/6c85ffe0a45f4d6581e2b0acf80290b0781024 [new file with mode: 0644]

diff --git a/57/6c85ffe0a45f4d6581e2b0acf80290b0781024 b/57/6c85ffe0a45f4d6581e2b0acf80290b0781024
new file mode 100644 (file)
index 0000000..808dcab
--- /dev/null
@@ -0,0 +1,105 @@
+Return-Path: <bremner@tethera.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id CDF58429E25\r
+       for <notmuch@notmuchmail.org>; Sun,  4 Dec 2011 17:55:13 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.3\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id 1obfKB7zj6lW for <notmuch@notmuchmail.org>;\r
+       Sun,  4 Dec 2011 17:55:13 -0800 (PST)\r
+Received: from tempo.its.unb.ca (tempo.its.unb.ca [131.202.1.21])\r
+       (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 3AB2D429E21\r
+       for <notmuch@notmuchmail.org>; Sun,  4 Dec 2011 17:55:13 -0800 (PST)\r
+Received: from zancas.localnet\r
+       (fctnnbsc36w-156034079193.pppoe-dynamic.High-Speed.nb.bellaliant.net\r
+       [156.34.79.193]) (authenticated bits=0)\r
+       by tempo.its.unb.ca (8.13.8/8.13.8) with ESMTP id pB51t84E026247\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO);\r
+       Sun, 4 Dec 2011 21:55:09 -0400\r
+Received: from bremner by zancas.localnet with local (Exim 4.77)\r
+       (envelope-from <bremner@tethera.net>)\r
+       id 1RXNls-0007Qx-FP; Sun, 04 Dec 2011 21:55:08 -0400\r
+From: David Bremner <david@tethera.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] test: add tests for python bindings\r
+Date: Sun,  4 Dec 2011 21:54:28 -0400\r
+Message-Id: <1323050068-28544-1-git-send-email-david@tethera.net>\r
+X-Mailer: git-send-email 1.7.7.3\r
+In-Reply-To: <1323027314-8764-1-git-send-email-david@tethera.net>\r
+References: <1323027314-8764-1-git-send-email-david@tethera.net>\r
+Cc: David Bremner <bremner@debian.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 05 Dec 2011 01:55:13 -0000\r
+\r
+From: David Bremner <bremner@debian.org>\r
+\r
+We start modestly, with a (slightly modified) test case from Kazuo\r
+Teramoto. Originally it just made sure the bindings didn't crash; here\r
+we check that by comparing the output with that of notmuch search.\r
+---\r
+ test/notmuch-test |    1 +\r
+ test/python       |   20 ++++++++++++++++++++\r
+ 2 files changed, 21 insertions(+), 0 deletions(-)\r
+ create mode 100755 test/python\r
+\r
+diff --git a/test/notmuch-test b/test/notmuch-test\r
+index adfd589..e77f3c5 100755\r
+--- a/test/notmuch-test\r
++++ b/test/notmuch-test\r
+@@ -46,6 +46,7 @@ TESTS="\r
+   symbol-hiding\r
+   search-folder-coherence\r
+   atomicity\r
++  python\r
+ "\r
+ TESTS=${NOTMUCH_TESTS:=$TESTS}\r
\r
+diff --git a/test/python b/test/python\r
+new file mode 100755\r
+index 0000000..28a8aab\r
+--- /dev/null\r
++++ b/test/python\r
+@@ -0,0 +1,20 @@\r
++#!/usr/bin/env bash\r
++test_description="python bindings"\r
++. ./test-lib.sh\r
++\r
++add_email_corpus\r
++\r
++# This test relies on the output from the python Thread.__str__\r
++# method being byte compatible with that from notmuch search.\r
++\r
++test_begin_subtest "compare with notmuch search"\r
++python <<EOF > OUTPUT\r
++import notmuch\r
++db = notmuch.Database(mode=notmuch.Database.MODE.READ_WRITE)\r
++q_new = notmuch.Query(db, 'tag:inbox')\r
++for t in q_new.search_threads():\r
++    print unicode(t)\r
++EOF\r
++notmuch search tag:inbox > EXPECTED\r
++test_expect_equal_file OUTPUT EXPECTED\r
++test_done\r
+-- \r
+1.7.7.3\r
+\r