]> git.notmuchmail.org Git - notmuch/blobdiff - bindings/python-cffi/tests/test_database.py
Support aborting the atomic context
[notmuch] / bindings / python-cffi / tests / test_database.py
index e3a8344d8cded01e3a0ee3895faaa9173a816745..a2c69de61366f91aebebe5e6f9fc4f9255e918c0 100644 (file)
@@ -127,6 +127,11 @@ class TestAtomic:
         with pytest.raises(errors.UnbalancedAtomicError):
             ctx.force_end()
 
+    def test_abort(self, db):
+        with db.atomic() as txn:
+            txn.abort()
+        assert db.closed
+
 
 class TestRevision:
 
@@ -324,3 +329,14 @@ class TestQuery:
         threads = db.threads('*')
         thread = next(threads)
         assert isinstance(thread, notmuch2.Thread)
+
+    def test_use_threaded_message_twice(self, db):
+        thread = next(db.threads('*'))
+        for msg in thread.toplevel():
+            assert isinstance(msg, notmuch2.Message)
+            assert msg.alive
+            del msg
+        for msg in thread:
+            assert isinstance(msg, notmuch2.Message)
+            assert msg.alive
+            del msg