[PATCH] test: add tests for python bindings
David Bremner
david at tethera.net
Sun Dec 4 17:54:28 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.
---
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 <<EOF > 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
More information about the notmuch
mailing list