diff options
| author | Floris Bruynooghe <flub@devork.be> | 2020-06-15 22:58:50 +0200 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2020-06-16 08:02:02 -0300 |
| commit | 2d895a0119b423b117d10e890c9e0eb5d2a9cdf8 (patch) | |
| tree | 53cac8051fb2e09b9be94972365ad6d3af956c6b /bindings/python-cffi/tests | |
| parent | 131757907907380213b32934d9e73cec942ace43 (diff) | |
Make messages returned by Thread objects owned
This reverses the logic of StandaloneMessage to instead create a
OwnedMessage. Only the Thread class allows retrieving messages more
then once so it can explicitly create such messages.
The added test fails with SIGABRT without the fix for the message
re-use in threads being present.
Diffstat (limited to 'bindings/python-cffi/tests')
| -rw-r--r-- | bindings/python-cffi/tests/test_database.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/bindings/python-cffi/tests/test_database.py b/bindings/python-cffi/tests/test_database.py index e3a8344d..55069b5e 100644 --- a/bindings/python-cffi/tests/test_database.py +++ b/bindings/python-cffi/tests/test_database.py @@ -324,3 +324,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 |
