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