test: add tests for python bindings

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 commit is contained in:
David Bremner 2011-12-04 21:50:08 -04:00
parent 69dc421ab3
commit 6cca3a5c16
2 changed files with 18 additions and 0 deletions

View file

@ -47,6 +47,7 @@ TESTS="
symbol-hiding
search-folder-coherence
atomicity
python
"
TESTS=${NOTMUCH_TESTS:=$TESTS}

17
test/python Executable file
View file

@ -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