X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=bindings%2Fpython-cffi%2Ftests%2Ftest_database.py;h=9b3219c00e634a9e4d91fa6d3c7c329dd8e59aa2;hb=ac67cd84eea1148680ab3a377d35ae346073f138;hp=e3a8344d8cded01e3a0ee3895faaa9173a816745;hpb=e2df30f7a98f91543d0b3561dbb366eb4b3d812c;p=notmuch diff --git a/bindings/python-cffi/tests/test_database.py b/bindings/python-cffi/tests/test_database.py index e3a8344d..9b3219c0 100644 --- a/bindings/python-cffi/tests/test_database.py +++ b/bindings/python-cffi/tests/test_database.py @@ -80,7 +80,7 @@ class TestCreate: db.create(tmppath) def test_create_existing(self, tmppath, db): - with pytest.raises(errors.FileError): + with pytest.raises(errors.DatabaseExistsError): dbmod.Database.create(path=tmppath) def test_close(self, db): @@ -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