[Patch v2 2/5] test: add python tests for query.count_{messages,threads}

David Bremner david at tethera.net
Tue Dec 30 12:29:37 PST 2014


These are more or less cargo culted from the existing python tests. In
particular they compare against the results of doing an analogous
query using the CLI.
---
 test/T390-python.sh | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/test/T390-python.sh b/test/T390-python.sh
index 3f03a2e..ddbf164 100755
--- a/test/T390-python.sh
+++ b/test/T390-python.sh
@@ -36,4 +36,24 @@ print db.find_message_by_filename("i-dont-exist")
 EOF
 test_expect_equal "$(cat OUTPUT)" "None"
 
+test_begin_subtest "count messages"
+test_python <<EOF
+import notmuch
+db = notmuch.Database(mode=notmuch.Database.MODE.READ_ONLY)
+q_new = notmuch.Query(db, 'tag:inbox')
+print q_new.count_messages()
+EOF
+notmuch count --output=messages tag:inbox > EXPECTED
+test_expect_equal_file OUTPUT EXPECTED
+
+test_begin_subtest "count threads"
+test_python <<EOF
+import notmuch
+db = notmuch.Database(mode=notmuch.Database.MODE.READ_ONLY)
+q_new = notmuch.Query(db, 'tag:inbox')
+print q_new.count_threads()
+EOF
+notmuch count --output=threads tag:inbox > EXPECTED
+test_expect_equal_file OUTPUT EXPECTED
+
 test_done
-- 
2.1.3



More information about the notmuch mailing list