← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:fix-stormify-message into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:fix-stormify-message into launchpad:master.

Commit message:
Fix bugs-emailinterface.rst after conversion of Message to Storm

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/446525

The `DecoratedResultSet` used in `Bug.messages` to replace the previous `SQLRelatedJoin(prejoins=["owner"])` can't support `__contains__` without a fair bit of work.  Fortunately this wasn't needed very much.  There was one use in `Bug.linkMessage` which I already replaced with an explicit Storm query, but I missed the uses of it in `bugs-emailinterface.rst`.

In a test we don't need to care much about performance, so I just used `set(bug.messages)` to materialize the result of the query and turn it into something that supports `__contains__`.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:fix-stormify-message into launchpad:master.
diff --git a/lib/lp/bugs/tests/bugs-emailinterface.rst b/lib/lp/bugs/tests/bugs-emailinterface.rst
index 6ae9275..7515c9c 100644
--- a/lib/lp/bugs/tests/bugs-emailinterface.rst
+++ b/lib/lp/bugs/tests/bugs-emailinterface.rst
@@ -297,7 +297,7 @@ includes commands, the email has to be OpenPGP-signed.
     >>> from lp.services.messages.interfaces.message import IMessageSet
     >>> bug_one = bugset.get(1)
     >>> added_message = getUtility(IMessageSet).get("<yada-yada-test1>")[0]
-    >>> added_message in bug_one.messages
+    >>> added_message in set(bug_one.messages)
     True
     >>> print(bug_one.title)
     Better summary
@@ -522,7 +522,7 @@ to the bug:
 
     >>> added_message = getUtility(IMessageSet).get("<yada-yada-test3>")[0]
     >>> bug_one = bugset.get(1)
-    >>> added_message in bug_one.messages
+    >>> added_message in set(bug_one.messages)
     True
 
 In these tests, every time we log in, we're fully trusted again:
@@ -2962,7 +2962,7 @@ Attachments sent in replies to existing bugs are stored too.
     >>> new_message = getUtility(IMessageSet).get("comment-with-attachment")[
     ...     0
     ... ]
-    >>> new_message in bug_one.messages
+    >>> new_message in set(bug_one.messages)
     True
     >>> print_attachments(new_message.bugattachments)
     LibraryFileAlias attachment.txt text/plain UNSPECIFIED