[PATCH] test: add tests for python bindings

David Bremner david at tethera.net
Mon Dec 5 14:11:06 PST 2011


From: David Bremner <bremner at debian.org>

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 <<EOF | sort > 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



More information about the notmuch mailing list