aboutsummaryrefslogtreecommitdiff
path: root/bindings/python-cffi/tests/test_database.py
diff options
context:
space:
mode:
authorFloris Bruynooghe <flub@devork.be>2020-06-14 17:23:19 +0200
committerDavid Bremner <david@tethera.net>2020-06-16 08:17:39 -0300
commit776a54a0e437651abd69a03b9f7d591ea1f992cb (patch)
treeece802dc23cc8cf8c8e6774006b586ad5e2fdd92 /bindings/python-cffi/tests/test_database.py
parent2d895a0119b423b117d10e890c9e0eb5d2a9cdf8 (diff)
Support aborting the atomic context
Since it is possible to use an atomic context to abort a number of changes support this usage. Because the only way to actually abort the transaction is to close the database this must also do so. Amended by db: Note the limitation requiring close is a limitation of the underlying notmuch API, which should be fixed in a future notmuch release.
Diffstat (limited to 'bindings/python-cffi/tests/test_database.py')
-rw-r--r--bindings/python-cffi/tests/test_database.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/bindings/python-cffi/tests/test_database.py b/bindings/python-cffi/tests/test_database.py
index 55069b5e..a2c69de6 100644
--- a/bindings/python-cffi/tests/test_database.py
+++ b/bindings/python-cffi/tests/test_database.py
@@ -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: