Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 6B9D3429E25 for ; Mon, 5 Dec 2011 14:11:21 -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 GEDbIp0NdIXF for ; Mon, 5 Dec 2011 14:11:21 -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 DADB1431FB6 for ; Mon, 5 Dec 2011 14:11:20 -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 pB5MBDgX030511 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO); Mon, 5 Dec 2011 18:11:16 -0400 Received: from bremner by zancas.localnet with local (Exim 4.77) (envelope-from ) id 1RXgkj-0003sv-DV; Mon, 05 Dec 2011 18:11:13 -0400 From: David Bremner To: notmuch@notmuchmail.org Subject: [PATCH] test: add tests for python bindings Date: Mon, 5 Dec 2011 18:11:06 -0400 Message-Id: <1323123066-14890-1-git-send-email-david@tethera.net> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1323050068-28544-1-git-send-email-david@tethera.net> References: <1323050068-28544-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 22:11:21 -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. --- This version of the test is less ambitious, and just checks thread ids match. test/notmuch-test | 1 + test/python | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 0 deletions(-) create mode 100755 test/python diff --git a/test/notmuch-test b/test/notmuch-test index 5aced5c..113ea7c 100755 --- a/test/notmuch-test +++ b/test/notmuch-test @@ -47,6 +47,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..179427b --- /dev/null +++ b/test/python @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +test_description="python bindings" +. ./test-lib.sh + +add_email_corpus + +test_begin_subtest "compare thread ids" +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 t.get_thread_id() +EOF +notmuch search --output=threads tag:inbox | sed s/^thread:// | sort > EXPECTED +test_expect_equal_file OUTPUT EXPECTED +test_done -- 1.7.7.3