]> git.notmuchmail.org Git - notmuch/commitdiff
test: add tests for python bindings
authorDavid Bremner <bremner@debian.org>
Mon, 5 Dec 2011 01:50:08 +0000 (21:50 -0400)
committerDavid Bremner <bremner@debian.org>
Mon, 5 Dec 2011 22:06:48 +0000 (18:06 -0400)
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
test/python [new file with mode: 0755]

index 5aced5cef9fdb98cd1c213486de1e0f008371c90..113ea7cf3330ee8b51fdf9fde3c2ec5fd3ec524c 100755 (executable)
@@ -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 (executable)
index 0000000..179427b
--- /dev/null
@@ -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