← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:py3-zip into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:py3-zip into launchpad:master.

Commit message:
Don't assume zip returns a list

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

On Python 3 it returns an iterator instead.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-zip into launchpad:master.
diff --git a/lib/lp/archivepublisher/tests/test_generate_ppa_htaccess.py b/lib/lp/archivepublisher/tests/test_generate_ppa_htaccess.py
index 34522f0..f11dba1 100644
--- a/lib/lp/archivepublisher/tests/test_generate_ppa_htaccess.py
+++ b/lib/lp/archivepublisher/tests/test_generate_ppa_htaccess.py
@@ -150,7 +150,7 @@ class TestPPAHtaccessTokenGeneration(TestCaseWithFactory):
             line.strip().split(':', 1) for line in open(filename, 'r')]
 
         # First entry is buildd secret, rest are from tokens.
-        usernames = list(zip(*file_contents)[0])
+        usernames = list(list(zip(*file_contents))[0])
         self.assertEqual(['buildd'] + token_usernames, usernames)
 
         # We can re-encrypt the buildd_secret and it should match the
diff --git a/lib/lp/code/mail/tests/test_branchmergeproposal.py b/lib/lp/code/mail/tests/test_branchmergeproposal.py
index c6c0fdc..0a0fd9a 100644
--- a/lib/lp/code/mail/tests/test_branchmergeproposal.py
+++ b/lib/lp/code/mail/tests/test_branchmergeproposal.py
@@ -548,7 +548,7 @@ class TestMergeProposalMailing(TestCaseWithFactory):
 
     def assertRecipientsMatches(self, recipients, mailer):
         """Assert that `mailer` will send to the people in `recipients`."""
-        persons = zip(*(mailer._recipients.getRecipientPersons()))[1]
+        persons = list(zip(*(mailer._recipients.getRecipientPersons())))[1]
         self.assertEqual(set(recipients), set(persons))
 
     def makeReviewRequest(self):
diff --git a/lib/lp/code/mail/tests/test_codereviewcomment.py b/lib/lp/code/mail/tests/test_codereviewcomment.py
index a692a97..086b69e 100644
--- a/lib/lp/code/mail/tests/test_codereviewcomment.py
+++ b/lib/lp/code/mail/tests/test_codereviewcomment.py
@@ -77,7 +77,7 @@ class TestCodeReviewComment(TestCaseWithFactory):
 
     def assertRecipientsMatches(self, recipients, mailer):
         """Assert that `mailer` will send to the people in `recipients`."""
-        persons = zip(*(mailer._recipients.getRecipientPersons()))[1]
+        persons = list(zip(*(mailer._recipients.getRecipientPersons())))[1]
         self.assertEqual(set(recipients), set(persons))
 
     def test_forCreation(self):
diff --git a/lib/lp/code/model/branch.py b/lib/lp/code/model/branch.py
index 5e756d0..dac3b4a 100644
--- a/lib/lp/code/model/branch.py
+++ b/lib/lp/code/model/branch.py
@@ -665,7 +665,7 @@ class Branch(SQLBase, WebhookTargetMixin, BzrIdentityMixin):
         if len(reviewers) != len(review_types):
             raise WrongNumberOfReviewTypeArguments(
                 'reviewers and review_types must be equal length.')
-        review_requests = zip(reviewers, review_types)
+        review_requests = list(zip(reviewers, review_types))
         return self.addLandingTarget(
             registrant, merge_target, merge_prerequisite,
             needs_review=needs_review, description=initial_comment,
diff --git a/lib/lp/code/model/gitref.py b/lib/lp/code/model/gitref.py
index 406c8de..6d5559e 100644
--- a/lib/lp/code/model/gitref.py
+++ b/lib/lp/code/model/gitref.py
@@ -617,7 +617,7 @@ class GitRef(StormBase, GitRefMixin):
         if len(reviewers) != len(review_types):
             raise WrongNumberOfReviewTypeArguments(
                 'reviewers and review_types must be equal length.')
-        review_requests = zip(reviewers, review_types)
+        review_requests = list(zip(reviewers, review_types))
         return self.addLandingTarget(
             registrant, merge_target, merge_prerequisite,
             needs_review=needs_review, description=initial_comment,
diff --git a/lib/lp/services/database/decoratedresultset.py b/lib/lp/services/database/decoratedresultset.py
index 8f3661a..fed8dc4 100644
--- a/lib/lp/services/database/decoratedresultset.py
+++ b/lib/lp/services/database/decoratedresultset.py
@@ -86,7 +86,7 @@ class DecoratedResultSet(object):
             assert (
                 removeSecurityProxy(self.result_set).return_both
                     == self.return_both)
-            return zip(*results)
+            return tuple(zip(*results))
         else:
             return results, results