← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:next-builtin into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:next-builtin into launchpad:master.

Commit message:
Use next(iterator) rather than iterator.next()

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/380096
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:next-builtin into launchpad:master.
diff --git a/lib/lp/answers/doc/karma.txt b/lib/lp/answers/doc/karma.txt
index 2a978d5..6d45d07 100644
--- a/lib/lp/answers/doc/karma.txt
+++ b/lib/lp/answers/doc/karma.txt
@@ -64,7 +64,7 @@ Creating a question
     >>> firefox = getUtility(IProductSet)['firefox']
     >>> firefox_question = firefox.newQuestion(
     ...     title='New question', description='Question description.',
-    ...     owner=sample_person, datecreated=now.next())
+    ...     owner=sample_person, datecreated=next(now))
     Karma added: action=questionasked, product=firefox, person=name12
 
 
@@ -77,7 +77,7 @@ will usually be called by an automated script.
     >>> msg = firefox_question.expireQuestion(
     ...     foo_bar, 'Expiring because of inactivity. Reopen if you are '
     ...     'still having the problem and provide additional information.',
-    ...     datecreated=now.next())
+    ...     datecreated=next(now))
 
 
 Reopening a question
@@ -85,7 +85,7 @@ Reopening a question
 
     >>> msg = firefox_question.reopen(
     ...     "Firefox doesn't have any 'Quick Searches' in its bookmarks.",
-    ...     datecreated=now.next())
+    ...     datecreated=next(now))
     Karma added: action=questionreopened, product=firefox, person=name12
 
 
@@ -94,7 +94,7 @@ Requesting for more information
 
     >>> msg = firefox_question.requestInfo(
     ...     foo_bar, 'What "Quick Searches" do you want?',
-    ...     datecreated=now.next())
+    ...     datecreated=next(now))
     Karma added: action=questionrequestedinfo, product=firefox, person=name16
 
 
@@ -103,7 +103,7 @@ Giving back more information
 
     >>> msg = firefox_question.giveInfo(
     ...     'The same one than shipped upstreams.',
-    ...     datecreated=now.next())
+    ...     datecreated=next(now))
     Karma added: action=questiongaveinfo, product=firefox, person=name12
 
 
@@ -112,7 +112,7 @@ Giving an answer to a question
 
     >>> msg = firefox_question.giveAnswer(
     ...     foo_bar, "Ok, I see what you mean. You need to install them "
-    ...     "manually for now.", datecreated=now.next())
+    ...     "manually for now.", datecreated=next(now))
     Karma added: action=questiongaveanswer, product=firefox, person=name16
 
 
@@ -121,7 +121,7 @@ Adding a comment
 
     >>> msg = firefox_question.addComment(
     ...     foo_bar, 'You could also fill a bug about that, if you like.',
-    ...     datecreated=now.next())
+    ...     datecreated=next(now))
     Karma added: action=questioncommentadded, product=firefox, person=name16
 
 
@@ -134,7 +134,7 @@ receives karma.
 
     >>> msg = firefox_question.confirmAnswer(
     ...     "Ok, thanks. I'll open a bug about this then.",
-    ...     answer=msg, datecreated=now.next())
+    ...     answer=msg, datecreated=next(now))
     Karma added: action=questionansweraccepted, product=firefox, person=name12
     Karma added: action=questionanswered, product=firefox, person=name16
 
@@ -156,7 +156,7 @@ We do not grant karma for status change made outside of workflow:
     >>> from lp.answers.enums import QuestionStatus
     >>> msg = firefox_question.setStatus(
     ...     foo_bar, QuestionStatus.OPEN, 'That rejection was an error.',
-    ...     datecreated=now.next())
+    ...     datecreated=next(now))
 
 
 Changing the title of a question
@@ -205,7 +205,7 @@ persons who were awarded it in the past.
     >>> msg = firefox_question.giveAnswer(
     ...     sample_person, "I was able to import some by following the "
     ...     "instructions on http://tinyurl.com/cyus4";,
-    ...     datecreated=now.next())
+    ...     datecreated=next(now))
 
 
 Creating a FAQ
diff --git a/lib/lp/answers/tests/emailinterface.txt b/lib/lp/answers/tests/emailinterface.txt
index 8718ea1..f30e23e 100644
--- a/lib/lp/answers/tests/emailinterface.txt
+++ b/lib/lp/answers/tests/emailinterface.txt
@@ -38,7 +38,7 @@ AnswerTrackerHandler.
     ...     lines = ['From: %s' % from_addr]
     ...     to_addr = 'question%s@xxxxxxxxxxxxxxxxxxxxx' % question_id
     ...     lines.append('To: %s' % to_addr)
-    ...     date = mktime_tz(now.next().utctimetuple() + (0, ))
+    ...     date = mktime_tz(next(now).utctimetuple() + (0, ))
     ...     lines.append('Date: %s' % formatdate(date))
     ...     msgid = make_msgid()
     ...     lines.append('Message-Id: %s' % msgid)
@@ -116,7 +116,7 @@ possibilities for the user.
     ...     question = ubuntu.newQuestion(
     ...         no_priv, 'Unable to boot installer',
     ...         "I've tried installing Ubuntu on a Mac. But the installer "
-    ...         "never boots.", datecreated=now.next())
+    ...         "never boots.", datecreated=next(now))
     ...     question_id = question.id
 
     # We need to refetch the question, since a new transaction was started.
@@ -127,7 +127,7 @@ possibilities for the user.
     >>> def setQuestionStatus(question, new_status):
     ...     login('foo.bar@xxxxxxxxxxxxx')
     ...     question.setStatus(foo_bar, new_status, 'Status Change',
-    ...                            datecreated=now.next())
+    ...                            datecreated=next(now))
     ...     login('no-priv@xxxxxxxxxxxxx')
 
 Message From the Question Owner
diff --git a/lib/lp/app/browser/launchpad.py b/lib/lp/app/browser/launchpad.py
index d12c849..4aa9a39 100644
--- a/lib/lp/app/browser/launchpad.py
+++ b/lib/lp/app/browser/launchpad.py
@@ -271,9 +271,9 @@ class Hierarchy(LaunchpadView):
         """The objects for which we want breadcrumbs."""
         # Start the chain with the deepest object that has a breadcrumb.
         try:
-            objects = [(
+            objects = [next((
                 obj for obj in reversed(self.request.traversed_objects)
-                if IBreadcrumb(obj, None)).next()]
+                if IBreadcrumb(obj, None)))]
         except StopIteration:
             return []
         # Now iterate. If an object has a breadcrumb, it can override
diff --git a/lib/lp/bugs/browser/tests/test_cve.py b/lib/lp/bugs/browser/tests/test_cve.py
index e0b485e..ee760e3 100644
--- a/lib/lp/bugs/browser/tests/test_cve.py
+++ b/lib/lp/bugs/browser/tests/test_cve.py
@@ -3,6 +3,7 @@
 
 """CVE related tests."""
 
+from functools import partial
 from operator import attrgetter
 import re
 
@@ -35,7 +36,7 @@ class TestCVEReportView(TestCaseWithFactory):
         self.resolved_bugtasks = []
         self.unresolved_bugtasks = []
         self.cves = {}
-        self.getCVE = self.cveGenerator().next
+        self.getCVE = partial(next, self.cveGenerator())
         with person_logged_in(distroseries.owner):
             for status in RESOLVED_BUGTASK_STATUSES:
                 tasks, cves = self.makeBugTasksWithCve(status, distroseries)
diff --git a/lib/lp/bugs/browser/widgets/bugtask.py b/lib/lp/bugs/browser/widgets/bugtask.py
index b17d19f..2f086b2 100644
--- a/lib/lp/bugs/browser/widgets/bugtask.py
+++ b/lib/lp/bugs/browser/widgets/bugtask.py
@@ -384,7 +384,7 @@ class BugTaskBugWatchWidget(RadioWidget):
             and len(self.vocabulary) > 0
             and self.context.required):
             # Grab the first item from the iterator:
-            values = [iter(self.vocabulary).next().value]
+            values = [next(iter(self.vocabulary)).value]
         elif value != self.context.missing_value:
             values = [value]
         else:
diff --git a/lib/lp/bugs/doc/bugcomment.txt b/lib/lp/bugs/doc/bugcomment.txt
index f98907b..a6e9c1c 100644
--- a/lib/lp/bugs/doc/bugcomment.txt
+++ b/lib/lp/bugs/doc/bugcomment.txt
@@ -270,7 +270,7 @@ We'll create an example bug with 9 comments.
     >>> def add_comments(bug, how_many):
     ...     bug_message_set = getUtility(IBugMessageSet)
     ...     for i in range(how_many):
-    ...         num = comment_counter.next()
+    ...         num = next(comment_counter)
     ...         bug_message_set.createMessage(
     ...             "Comment %d" % num, bug, bug.owner,
     ...             "Something or other #%d" % num)
diff --git a/lib/lp/bugs/externalbugtracker/mantis.py b/lib/lp/bugs/externalbugtracker/mantis.py
index 9cb8203..6021f37 100644
--- a/lib/lp/bugs/externalbugtracker/mantis.py
+++ b/lib/lp/bugs/externalbugtracker/mantis.py
@@ -140,7 +140,7 @@ class MantisBugBatchParser:
         # it because different Mantis instances have different header
         # ordering and even different columns in the export.
         try:
-            headers = [h.lower() for h in reader.next()]
+            headers = [h.lower() for h in next(reader)]
         except StopIteration:
             raise UnparsableBugData("Missing header line")
         missing_headers = [
diff --git a/lib/lp/bugs/externalbugtracker/roundup.py b/lib/lp/bugs/externalbugtracker/roundup.py
index f862aec..66f46ca 100644
--- a/lib/lp/bugs/externalbugtracker/roundup.py
+++ b/lib/lp/bugs/externalbugtracker/roundup.py
@@ -219,7 +219,7 @@ class Roundup(ExternalBugTracker):
         bug_id = int(bug_id)
         query_url = self.getSingleBugExportURL(bug_id)
         reader = csv.DictReader(self._getPage(query_url).iter_lines())
-        return (bug_id, reader.next())
+        return (bug_id, next(reader))
 
     def getRemoteBugBatch(self, bug_ids):
         """See `ExternalBugTracker`"""
diff --git a/lib/lp/bugs/externalbugtracker/trac.py b/lib/lp/bugs/externalbugtracker/trac.py
index d10d8f2..ab36b7e 100644
--- a/lib/lp/bugs/externalbugtracker/trac.py
+++ b/lib/lp/bugs/externalbugtracker/trac.py
@@ -151,7 +151,7 @@ class Trac(ExternalBugTracker):
         # We read the remote bugs into a list so that we can check that
         # the data we're getting back from the remote server are valid.
         csv_reader = csv.DictReader(self._getPage(query_url).iter_lines())
-        remote_bugs = [csv_reader.next()]
+        remote_bugs = [next(csv_reader)]
 
         # We consider the data we're getting from the remote server to
         # be valid if there is an ID field and a status field in the CSV
diff --git a/lib/lp/bugs/scripts/tests/test_bugnotification.py b/lib/lp/bugs/scripts/tests/test_bugnotification.py
index 1b3f4cb..734b68f 100644
--- a/lib/lp/bugs/scripts/tests/test_bugnotification.py
+++ b/lib/lp/bugs/scripts/tests/test_bugnotification.py
@@ -427,7 +427,7 @@ class TestGetEmailNotifications(TestCase):
         # Now we create the generator, start it, and then close it, triggering
         # a GeneratorExit exception inside the generator.
         email_notifications = get_email_notifications(notifications)
-        email_notifications.next()
+        next(email_notifications)
         email_notifications.close()
 
         # Verify that no "Error while building email notifications." is logged.
@@ -706,7 +706,7 @@ class EmailNotificationsBugMixin:
     def test_change_seen(self):
         # A smoketest.
         self.change(self.old, self.new)
-        message, body = self.get_messages().next()
+        message, body = next(self.get_messages())
         self.assertThat(body, Contains(self.unexpected_text))
 
     def test_undone_change_sends_no_emails(self):
@@ -718,7 +718,7 @@ class EmailNotificationsBugMixin:
         self.change(self.old, self.new)
         self.change(self.new, self.old)
         self.change_other()
-        message, body = self.get_messages().next()
+        message, body = next(self.get_messages())
         self.assertThat(body, Not(Contains(self.unexpected_text)))
 
     def test_multiple_undone_changes_sends_no_emails(self):
@@ -761,7 +761,7 @@ class EmailNotificationsBugTaskMixin(EmailNotificationsBugMixin):
             self.bug.addTask(self.product_owner, product2)
         self.change(self.old, self.new, index=0)
         self.change(self.new, self.old, index=1)
-        message, body = self.get_messages().next()
+        message, body = next(self.get_messages())
         self.assertThat(body, Contains(self.unexpected_text))
 
 
@@ -775,7 +775,7 @@ class EmailNotificationsAddedRemovedMixin:
 
     def test_added_seen(self):
         self.add(self.old)
-        message, body = self.get_messages().next()
+        message, body = next(self.get_messages())
         self.assertThat(body, Contains(self.added_message))
 
     def test_added_removed_sends_no_emails(self):
@@ -791,7 +791,7 @@ class EmailNotificationsAddedRemovedMixin:
     def test_added_another_removed_sends_emails(self):
         self.add(self.old)
         self.remove(self.new)
-        message, body = self.get_messages().next()
+        message, body = next(self.get_messages())
         self.assertThat(body, Contains(self.added_message))
         self.assertThat(body, Contains(self.removed_message))
 
diff --git a/lib/lp/code/browser/sourcepackagerecipe.py b/lib/lp/code/browser/sourcepackagerecipe.py
index 482d892..5ae3eee 100644
--- a/lib/lp/code/browser/sourcepackagerecipe.py
+++ b/lib/lp/code/browser/sourcepackagerecipe.py
@@ -755,7 +755,7 @@ class SourcePackageRecipeAddView(RecipeRelatedBranchesMixin,
         yield "%s-daily" % branch_target_name
         counter = itertools.count(1)
         while True:
-            yield "%s-daily-%s" % (branch_target_name, counter.next())
+            yield "%s-daily-%s" % (branch_target_name, next(counter))
 
     def _find_unused_name(self, owner):
         # Grab the last path element of the branch target path.
diff --git a/lib/lp/code/browser/tests/test_branchlisting.py b/lib/lp/code/browser/tests/test_branchlisting.py
index 8598090..5aed624 100644
--- a/lib/lp/code/browser/tests/test_branchlisting.py
+++ b/lib/lp/code/browser/tests/test_branchlisting.py
@@ -123,7 +123,7 @@ class TestPersonOwnedBranchesView(TestCaseWithFactory,
         self.branches = [
             self.factory.makeProductBranch(
                 product=self.bambam, owner=self.barney,
-                date_created=time_gen.next())
+                date_created=next(time_gen))
             for i in range(10)]
         self.bug = self.factory.makeBug()
         self.bug.linkBranch(self.branches[0], self.barney)
@@ -459,7 +459,7 @@ class TestGroupedDistributionSourcePackageBranchesView(TestCaseWithFactory):
             self.factory.makePackageBranch(
                 distroseries=distroseries,
                 sourcepackagename=self.sourcepackagename,
-                date_created=time_gen.next())
+                date_created=next(time_gen))
             for i in range(branch_count)]
 
         official = []
diff --git a/lib/lp/code/browser/tests/test_branchmergeproposal.py b/lib/lp/code/browser/tests/test_branchmergeproposal.py
index bf5bdb3..2e3055a 100644
--- a/lib/lp/code/browser/tests/test_branchmergeproposal.py
+++ b/lib/lp/code/browser/tests/test_branchmergeproposal.py
@@ -322,13 +322,13 @@ class TestBranchMergeProposalVoteView(TestCaseWithFactory):
             owner=reviewer,
             subject=self.factory.getUniqueString('subject'),
             vote=vote,
-            _date_created=self.date_generator.next())
+            _date_created=next(self.date_generator))
 
     def _nominateReviewer(self, reviewer, registrant):
         """Nominate a reviewer for the merge proposal."""
         self.bmp.nominateReviewer(
             reviewer=reviewer, registrant=registrant,
-            _date_created=self.date_generator.next())
+            _date_created=next(self.date_generator))
 
     def testNoVotes(self):
         # No votes should return empty lists
diff --git a/lib/lp/code/browser/tests/test_sourcepackagerecipe.py b/lib/lp/code/browser/tests/test_sourcepackagerecipe.py
index 97c7a1a..3b1124a 100644
--- a/lib/lp/code/browser/tests/test_sourcepackagerecipe.py
+++ b/lib/lp/code/browser/tests/test_sourcepackagerecipe.py
@@ -1362,12 +1362,12 @@ class TestSourcePackageRecipeViewMixin:
         # use id as the ordering attribute and lower ids mean created earlier.
         date_gen = time_counter(
             datetime(2010, 3, 16, tzinfo=UTC), timedelta(days=1))
-        build1 = self.makeBuildJob(recipe, date_gen.next())
-        build2 = self.makeBuildJob(recipe, date_gen.next())
-        build3 = self.makeBuildJob(recipe, date_gen.next())
-        build4 = self.makeBuildJob(recipe, date_gen.next())
-        build5 = self.makeBuildJob(recipe, date_gen.next())
-        build6 = self.makeBuildJob(recipe, date_gen.next())
+        build1 = self.makeBuildJob(recipe, next(date_gen))
+        build2 = self.makeBuildJob(recipe, next(date_gen))
+        build3 = self.makeBuildJob(recipe, next(date_gen))
+        build4 = self.makeBuildJob(recipe, next(date_gen))
+        build5 = self.makeBuildJob(recipe, next(date_gen))
+        build6 = self.makeBuildJob(recipe, next(date_gen))
         view = SourcePackageRecipeView(recipe, None)
         self.assertEqual(
             [build6, build5, build4, build3, build2, build1],
diff --git a/lib/lp/code/doc/branch.txt b/lib/lp/code/doc/branch.txt
index e9c654c..c1142c0 100644
--- a/lib/lp/code/doc/branch.txt
+++ b/lib/lp/code/doc/branch.txt
@@ -193,7 +193,7 @@ order.
     ...     """Create """
     ...     new_branch = factory.makeProductBranch(
     ...         branch_type=branch_type, owner=owner, product=product,
-    ...         name=name, date_created=time_generator.next())
+    ...         name=name, date_created=next(time_generator))
     ...     new_branch.last_scanned = new_branch.date_created
 
     >>> make_new_scanned_branch('oldest')
diff --git a/lib/lp/code/doc/codeimport-result.txt b/lib/lp/code/doc/codeimport-result.txt
index 39fe511..fd0b617 100644
--- a/lib/lp/code/doc/codeimport-result.txt
+++ b/lib/lp/code/doc/codeimport-result.txt
@@ -53,7 +53,7 @@ Then create a result object.
     >>> from lp.code.enums import CodeImportResultStatus
     >>> new_result = factory.makeCodeImportResult(
     ...     sample_import, result_status=CodeImportResultStatus.SUCCESS,
-    ...     date_started=time_source.next(), log_excerpt=log_excerpt,
+    ...     date_started=next(time_source), log_excerpt=log_excerpt,
     ...     log_alias=log_alias, machine=odin)
     >>> verifyObject(ICodeImportResult, new_result)
     True
@@ -95,9 +95,9 @@ method works as expected.
 
     >>> oldest_result = new_result
     >>> middle_result = factory.makeCodeImportResult(
-    ...     sample_import, date_started = time_source.next())
+    ...     sample_import, date_started = next(time_source))
     >>> newest_result = factory.makeCodeImportResult(
-    ...     sample_import, date_started = time_source.next())
+    ...     sample_import, date_started = next(time_source))
 
 Results for other imports of course should not be present in the
 results, so we should create one of those just to be sure that it's
diff --git a/lib/lp/code/model/branchnamespace.py b/lib/lp/code/model/branchnamespace.py
index 33f3305..95f70fc 100644
--- a/lib/lp/code/model/branchnamespace.py
+++ b/lib/lp/code/model/branchnamespace.py
@@ -489,7 +489,7 @@ class BranchNamespaceSet:
 
         def get_next_segment():
             try:
-                result = segments.next()
+                result = next(segments)
             except StopIteration:
                 raise InvalidNamespace('/'.join(traversed_segments))
             if result is None:
diff --git a/lib/lp/code/model/tests/test_branchcloud.py b/lib/lp/code/model/tests/test_branchcloud.py
index f0e8038..6c9cfbf 100644
--- a/lib/lp/code/model/tests/test_branchcloud.py
+++ b/lib/lp/code/model/tests/test_branchcloud.py
@@ -119,7 +119,7 @@ class TestBranchCloud(TestCaseWithFactory):
         store = Store.of(product)
         for i in range(4):
             revision = self.factory.makeRevision(
-                revision_date=date_generator.next())
+                revision_date=next(date_generator))
             cache = RevisionCache(revision)
             cache.product = product
             store.add(cache)
diff --git a/lib/lp/code/model/tests/test_codeimport.py b/lib/lp/code/model/tests/test_codeimport.py
index 1e36b30..a57f79e 100644
--- a/lib/lp/code/model/tests/test_codeimport.py
+++ b/lib/lp/code/model/tests/test_codeimport.py
@@ -532,11 +532,11 @@ class TestCodeImportResultsAttribute(TestCodeImportBase):
             origin=datetime(2007, 9, 9, 12, tzinfo=pytz.UTC),
             delta=timedelta(days=1))
         first = self.factory.makeCodeImportResult(
-            self.code_import, date_started=when.next())
+            self.code_import, date_started=next(when))
         second = self.factory.makeCodeImportResult(
-            self.code_import, date_started=when.next())
+            self.code_import, date_started=next(when))
         third = self.factory.makeCodeImportResult(
-            self.code_import, date_started=when.next())
+            self.code_import, date_started=next(when))
         self.assertTrue(first.date_job_started < second.date_job_started)
         self.assertTrue(second.date_job_started < third.date_job_started)
         results = list(self.code_import.results)
@@ -552,11 +552,11 @@ class TestCodeImportResultsAttribute(TestCodeImportBase):
             origin=datetime(2007, 9, 11, 12, tzinfo=pytz.UTC),
             delta=timedelta(days=-1))
         first = self.factory.makeCodeImportResult(
-            self.code_import, date_started=when.next())
+            self.code_import, date_started=next(when))
         second = self.factory.makeCodeImportResult(
-            self.code_import, date_started=when.next())
+            self.code_import, date_started=next(when))
         third = self.factory.makeCodeImportResult(
-            self.code_import, date_started=when.next())
+            self.code_import, date_started=next(when))
         self.assertTrue(first.date_job_started > second.date_job_started)
         self.assertTrue(second.date_job_started > third.date_job_started)
         results = list(self.code_import.results)
diff --git a/lib/lp/code/model/tests/test_revision.py b/lib/lp/code/model/tests/test_revision.py
index 5976f4e..67fd745 100644
--- a/lib/lp/code/model/tests/test_revision.py
+++ b/lib/lp/code/model/tests/test_revision.py
@@ -369,7 +369,7 @@ class GetPublicRevisionsTestCase(TestCaseWithFactory):
     def _makeRevision(self, revision_date=None):
         """Make a revision using the date generator."""
         if revision_date is None:
-            revision_date = self.date_generator.next()
+            revision_date = next(self.date_generator)
         return self.factory.makeRevision(
             revision_date=revision_date)
 
@@ -477,7 +477,7 @@ class TestGetPublicRevisionsForPerson(GetPublicRevisionsTestCase,
 
         `author` defaults to self.author if not set."""
         if revision_date is None:
-            revision_date = self.date_generator.next()
+            revision_date = next(self.date_generator)
         if author is None:
             author = self.author
         return self.factory.makeRevision(
@@ -955,7 +955,7 @@ class TestPruneRevisionCache(RevisionCacheTestCase):
             delta=timedelta(days=2))
         for i in range(4):
             revision = self.factory.makeRevision(
-                revision_date=date_generator.next())
+                revision_date=next(date_generator))
             cache = RevisionCache(revision)
             self.store.add(cache)
         RevisionSet.pruneRevisionCache(5)
@@ -968,7 +968,7 @@ class TestPruneRevisionCache(RevisionCacheTestCase):
             delta=timedelta(days=2))
         for i in range(4):
             revision = self.factory.makeRevision(
-                revision_date=date_generator.next())
+                revision_date=next(date_generator))
             cache = RevisionCache(revision)
             self.store.add(cache)
         RevisionSet.pruneRevisionCache(1)
diff --git a/lib/lp/code/model/tests/test_revisioncache.py b/lib/lp/code/model/tests/test_revisioncache.py
index 00e60d5..2f5ea2d 100644
--- a/lib/lp/code/model/tests/test_revisioncache.py
+++ b/lib/lp/code/model/tests/test_revisioncache.py
@@ -114,7 +114,7 @@ class TestRevisionCache(TestCaseWithFactory):
         # query is the reverse order.
         revisions = [
             self.makeCachedRevision(
-                revision=self.factory.makeRevision(revision_date=tc.next()))
+                revision=self.factory.makeRevision(revision_date=next(tc)))
             for i in range(4)]
         revisions.reverse()
         cache = getUtility(IRevisionCache)
@@ -142,7 +142,7 @@ class TestRevisionCache(TestCaseWithFactory):
         # Make four cached revisions spanning 33, 31, 29, and 27 days ago.
         for i in range(4):
             self.makeCachedRevision(
-                revision=self.factory.makeRevision(revision_date=tc.next()))
+                revision=self.factory.makeRevision(revision_date=next(tc)))
         cache = getUtility(IRevisionCache)
         self.assertEqual(2, cache.count())
 
diff --git a/lib/lp/code/stories/branches/xx-personproduct-branch-listings.txt b/lib/lp/code/stories/branches/xx-personproduct-branch-listings.txt
index b9c31c5..6275b92 100644
--- a/lib/lp/code/stories/branches/xx-personproduct-branch-listings.txt
+++ b/lib/lp/code/stories/branches/xx-personproduct-branch-listings.txt
@@ -27,14 +27,14 @@ that only the fooix branches are shown.
     ...     datetime(2007, 12, 1, tzinfo=pytz.UTC), timedelta(days=1))
     >>> branch = factory.makeProductBranch(
     ...     owner=eric, product=fooix, name="testing",
-    ...     date_created=date_generator.next())
+    ...     date_created=next(date_generator))
     >>> branch = factory.makeProductBranch(
     ...     owner=eric, product=fooix, name="feature",
-    ...     date_created=date_generator.next())
+    ...     date_created=next(date_generator))
     >>> branch = factory.makeAnyBranch(
-    ...     owner=eric, date_created=date_generator.next())
+    ...     owner=eric, date_created=next(date_generator))
     >>> branch = factory.makeAnyBranch(
-    ...     owner=eric, date_created=date_generator.next())
+    ...     owner=eric, date_created=next(date_generator))
     >>> logout()
 
     >>> browser.open('http://code.launchpad.test/~eric/fooix')
diff --git a/lib/lp/code/stories/feeds/xx-branch-atom.txt b/lib/lp/code/stories/feeds/xx-branch-atom.txt
index 7c91bca..c8e3628 100644
--- a/lib/lp/code/stories/feeds/xx-branch-atom.txt
+++ b/lib/lp/code/stories/feeds/xx-branch-atom.txt
@@ -21,7 +21,7 @@ by asking BeautifulSoup to use lxml.
     >>> def make_branch(owner, product, name):
     ...     global factory, date_generator
     ...     factory.makeProductBranch(name=name, product=product,
-    ...         owner=owner, date_created=date_generator.next())
+    ...         owner=owner, date_created=next(date_generator))
     >>> mike = factory.makePerson(name='mike', displayname='Mike Murphy')
     >>> mary = factory.makePerson(name='mary', displayname='Mary Murphy')
     >>> projectgroup = factory.makeProject(name='oh-man', displayname='Oh Man')
diff --git a/lib/lp/code/stories/feeds/xx-revision-atom.txt b/lib/lp/code/stories/feeds/xx-revision-atom.txt
index 0fadb05..3079a35 100644
--- a/lib/lp/code/stories/feeds/xx-revision-atom.txt
+++ b/lib/lp/code/stories/feeds/xx-revision-atom.txt
@@ -37,7 +37,7 @@ by asking BeautifulSoup to use lxml.
     ...     global factory, date_generator
     ...     return factory.makeRevision(
     ...         author=removeSecurityProxy(author).preferredemail.email,
-    ...         revision_date=date_generator.next(),
+    ...         revision_date=next(date_generator),
     ...         rev_id=rev_id, log_body=log_body)
     >>> ignored = fooey_branch.createBranchRevision(
     ...     1, makeRevision(
diff --git a/lib/lp/code/tests/codeimporthelpers.py b/lib/lp/code/tests/codeimporthelpers.py
index 34110cb..3e177f6 100644
--- a/lib/lp/code/tests/codeimporthelpers.py
+++ b/lib/lp/code/tests/codeimporthelpers.py
@@ -132,5 +132,5 @@ def make_all_result_types(code_import, factory, machine, start, count):
     for result_status in sorted(CodeImportResultStatus.items)[
             start:start + count]:
         factory.makeCodeImportResult(
-            code_import, result_status, start_dates.next(), end_dates.next(),
+            code_import, result_status, next(start_dates), next(end_dates),
             machine=machine)
diff --git a/lib/lp/code/tests/helpers.py b/lib/lp/code/tests/helpers.py
index 2955528..46f12ed 100644
--- a/lib/lp/code/tests/helpers.py
+++ b/lib/lp/code/tests/helpers.py
@@ -160,7 +160,7 @@ def consistent_branch_names():
         yield name
     index = count(1)
     while True:
-        yield "branch-%s" % index.next()
+        yield "branch-%s" % next(index)
 
 
 def make_package_branches(factory, series, sourcepackagename, branch_count,
@@ -180,8 +180,8 @@ def make_package_branches(factory, series, sourcepackagename, branch_count,
         factory.makePackageBranch(
             distroseries=series,
             sourcepackagename=sourcepackagename,
-            date_created=time_gen.next(),
-            name=branch_names.next(), owner=owner, registrant=registrant)
+            date_created=next(time_gen),
+            name=next(branch_names), owner=owner, registrant=registrant)
         for i in range(branch_count)]
 
     official = []
diff --git a/lib/lp/code/vocabularies/branch.py b/lib/lp/code/vocabularies/branch.py
index bd828ae..db4a39e 100644
--- a/lib/lp/code/vocabularies/branch.py
+++ b/lib/lp/code/vocabularies/branch.py
@@ -47,7 +47,7 @@ class BranchVocabulary(SQLObjectVocabularyBase):
         """See `IVocabularyTokenized`."""
         search_results = self.searchForTerms(token)
         if search_results.count() == 1:
-            return iter(search_results).next()
+            return next(iter(search_results))
         raise LookupError(token)
 
     def searchForTerms(self, query=None, vocab_filter=None):
diff --git a/lib/lp/code/vocabularies/gitrepository.py b/lib/lp/code/vocabularies/gitrepository.py
index 80f6524..0fc86d0 100644
--- a/lib/lp/code/vocabularies/gitrepository.py
+++ b/lib/lp/code/vocabularies/gitrepository.py
@@ -43,7 +43,7 @@ class GitRepositoryVocabulary(StormVocabularyBase):
         """See `IVocabularyTokenized`."""
         search_results = self.searchForTerms(token)
         if search_results.count() == 1:
-            return iter(search_results).next()
+            return next(iter(search_results))
         raise LookupError(token)
 
     def searchForTerms(self, query=None, vocab_filter=None):
diff --git a/lib/lp/codehosting/scanner/mergedetection.py b/lib/lp/codehosting/scanner/mergedetection.py
index 0e5dcd5..c73cd52 100644
--- a/lib/lp/codehosting/scanner/mergedetection.py
+++ b/lib/lp/codehosting/scanner/mergedetection.py
@@ -127,7 +127,7 @@ def find_merged_revno(merge_sorted, tip_rev_id):
     iterator = iter(merge_sorted)
     while True:
         try:
-            rev_id, depth, revno, ignored = iterator.next()
+            rev_id, depth, revno, ignored = next(iterator)
         except StopIteration:
             break
         if depth == 0:
diff --git a/lib/lp/codehosting/sftp.py b/lib/lp/codehosting/sftp.py
index 51d42e7..48e7671 100644
--- a/lib/lp/codehosting/sftp.py
+++ b/lib/lp/codehosting/sftp.py
@@ -111,7 +111,7 @@ class DirectoryListing:
         return self
 
     def next(self):
-        return self.iter.next()
+        return next(self.iter)
 
     def close(self):
         # I can't believe we had to implement a whole class just to
@@ -191,7 +191,7 @@ class TransportSFTPFile:
             self._escaped_path, [(offset, length)])
 
         def get_first_chunk(read_things):
-            return read_things.next()[1]
+            return next(read_things)[1]
 
         def handle_short_read(failure):
             """Handle short reads by reading what was available.
diff --git a/lib/lp/codehosting/vfs/tests/test_branchfs.py b/lib/lp/codehosting/vfs/tests/test_branchfs.py
index 0aa7fe7..9e0896b 100644
--- a/lib/lp/codehosting/vfs/tests/test_branchfs.py
+++ b/lib/lp/codehosting/vfs/tests/test_branchfs.py
@@ -607,7 +607,7 @@ class LaunchpadTransportTests:
             [(3, 2)])
 
         def get_chunk(generator):
-            return generator.next()[1]
+            return next(generator)[1]
         deferred.addCallback(get_chunk)
         return deferred.addCallback(self.assertEqual, data[3:5])
 
diff --git a/lib/lp/registry/doc/person-merge.txt b/lib/lp/registry/doc/person-merge.txt
index 55d627a..ffb12b9 100644
--- a/lib/lp/registry/doc/person-merge.txt
+++ b/lib/lp/registry/doc/person-merge.txt
@@ -294,7 +294,7 @@ create, and then delete, the needed two people.
 
 First, we will test a merge where there is no decoration.
 
-    >>> winner, loser = endless_supply_of_players.next()
+    >>> winner, loser = next(endless_supply_of_players)
     >>> print decorator_refs(store, winner, loser)
     <BLANKLINE>
 
@@ -316,7 +316,7 @@ There should still be no columns that reference the winner or loser.
 OK, now, this time, we will add some decorator information to the winner
 but not the loser.
 
-    >>> winner, loser = endless_supply_of_players.next()
+    >>> winner, loser = next(endless_supply_of_players)
     >>> winner.setLocation(None, None, 'America/Santiago', winner)
     >>> print decorator_refs(store, winner, loser)
     winner, winner,
@@ -333,7 +333,7 @@ the winner:
 This time, we will have a decorator for the person that is being merged
 INTO another person, but nothing on the target person.
 
-    >>> winner, loser = endless_supply_of_players.next()
+    >>> winner, loser = next(endless_supply_of_players)
     >>> loser.setLocation(None, None, 'America/Santiago', loser)
     >>> print decorator_refs(store, winner, loser)
     loser, loser,
@@ -352,7 +352,7 @@ to_person and the from_person. We expect that the from_person record
 will remain as noise but non-unique columns will have been updated to
 point to the winner, and the to_person will be unaffected.
 
-    >>> winner, loser = endless_supply_of_players.next()
+    >>> winner, loser = next(endless_supply_of_players)
     >>> winner.setLocation(None, None, 'America/Santiago', winner)
     >>> loser.setLocation(None, None, 'America/New_York', loser)
     >>> print decorator_refs(store, winner, loser)
diff --git a/lib/lp/registry/doc/standing.txt b/lib/lp/registry/doc/standing.txt
index 1678d43..fa3df52 100644
--- a/lib/lp/registry/doc/standing.txt
+++ b/lib/lp/registry/doc/standing.txt
@@ -41,7 +41,7 @@ are not a member of, their message gets held for moderator approval.
     ... Date: %s
     ...
     ... Point of order!
-    ... """ % (from_address, to_team_name, message_ids.next(), formatdate()))
+    ... """ % (from_address, to_team_name, next(message_ids), formatdate()))
     ...     mailing_list = getUtility(IMailingListSet).get(to_team_name)
     ...     held_message = mailing_list.holdMessage(message)
     ...     return held_message
diff --git a/lib/lp/registry/tests/test_milestonetag.py b/lib/lp/registry/tests/test_milestonetag.py
index 93ab917..d3cad1e 100644
--- a/lib/lp/registry/tests/test_milestonetag.py
+++ b/lib/lp/registry/tests/test_milestonetag.py
@@ -70,7 +70,7 @@ class MilestoneTagTest(TestCaseWithFactory):
             MilestoneTag.created_by_id,
             MilestoneTag.date_created,
             )
-        created_by_id, date_created = values.next()
+        created_by_id, date_created = next(values)
         self.assertEqual(self.person.id, created_by_id)
         self.assertIsInstance(date_created, datetime.datetime)
 
diff --git a/lib/lp/services/apachelogparser/base.py b/lib/lp/services/apachelogparser/base.py
index 8f3a438..f2e556a 100644
--- a/lib/lp/services/apachelogparser/base.py
+++ b/lib/lp/services/apachelogparser/base.py
@@ -112,7 +112,7 @@ def parse_file(fd, start_position, logger, get_download_key, parsed_lines=0):
         # logfile that has been rotated already, so it should be safe to
         # parse its last line.
         try:
-            next_line = fd.next()
+            next_line = next(fd)
         except StopIteration:
             if parsed_lines > 0:
                 break
diff --git a/lib/lp/services/doc/propertycache.txt b/lib/lp/services/doc/propertycache.txt
index a4f2097..cd1fadf 100644
--- a/lib/lp/services/doc/propertycache.txt
+++ b/lib/lp/services/doc/propertycache.txt
@@ -17,7 +17,7 @@ and then returned each time it is asked for.
     >>> class Foo(object):
     ...     @cachedproperty
     ...     def bar(self):
-    ...         return counter.next()
+    ...         return next(counter)
 
     >>> foo = Foo()
 
diff --git a/lib/lp/services/gpg/tests/test_gpghandler.py b/lib/lp/services/gpg/tests/test_gpghandler.py
index ca24c3b..7007553 100644
--- a/lib/lp/services/gpg/tests/test_gpghandler.py
+++ b/lib/lp/services/gpg/tests/test_gpghandler.py
@@ -144,7 +144,7 @@ class TestGPGHandler(TestCase):
     def test_non_ascii_filter(self):
         """localKeys should not error if passed non-ascii unicode strings."""
         filtered_keys = self.gpg_handler.localKeys(u'non-ascii \u8463')
-        self.assertRaises(StopIteration, filtered_keys.next)
+        self.assertRaises(StopIteration, next, filtered_keys)
 
     def testTestkeyrings(self):
         """Do we have the expected test keyring files"""
diff --git a/lib/lp/services/librarianserver/swift.py b/lib/lp/services/librarianserver/swift.py
index db01746..8f7f157 100644
--- a/lib/lp/services/librarianserver/swift.py
+++ b/lib/lp/services/librarianserver/swift.py
@@ -309,7 +309,7 @@ class SwiftStream:
 
     def _next_chunk(self):
         try:
-            return self._chunks.next()
+            return next(self._chunks)
         except StopIteration:
             return None
 
diff --git a/lib/lp/services/mail/tests/mbox_mailer.txt b/lib/lp/services/mail/tests/mbox_mailer.txt
index 0c67cfc..8e88bd2 100644
--- a/lib/lp/services/mail/tests/mbox_mailer.txt
+++ b/lib/lp/services/mail/tests/mbox_mailer.txt
@@ -25,7 +25,7 @@ Read the mbox file and make sure the message we just mailed is in there.
     >>> from mailbox import UnixMailbox
     >>> mbox_file = open(mbox_filename)
     >>> mbox = UnixMailbox(mbox_file)
-    >>> msg = mbox.next()
+    >>> msg = next(mbox)
     >>> msg['from']
     'geddy@xxxxxxxxxxx'
     >>> msg['to']
@@ -43,7 +43,7 @@ Read the mbox file and make sure the message we just mailed is in there.
 
 There should be no other messages in the mbox file.
 
-    >>> mbox.next()
+    >>> next(mbox)
     >>> mbox_file.close()
 
 Create another mailer, again that overwrites.  Make sure it actually does
@@ -63,10 +63,10 @@ overwrite.
 
     >>> mbox_file = open(mbox_filename)
     >>> mbox = UnixMailbox(mbox_file)
-    >>> msg = mbox.next()
+    >>> msg = next(mbox)
     >>> msg['from']
     'mick@xxxxxxxxxxx'
-    >>> mbox.next()
+    >>> next(mbox)
     >>> mbox_file.close()
 
 Create another mailer, this time one that does not overwrite.  Both the
@@ -87,10 +87,10 @@ mbox file.
 
     >>> mbox_file = open(mbox_filename)
     >>> mbox = UnixMailbox(mbox_file)
-    >>> msg = mbox.next()
+    >>> msg = next(mbox)
     >>> msg['from']
     'mick@xxxxxxxxxxx'
-    >>> msg = mbox.next()
+    >>> msg = next(mbox)
     >>> msg['from']
     'carol@xxxxxxxxxxx'
     >>> mbox_file.close()
@@ -120,14 +120,14 @@ harness.
 
     >>> mbox_file = open(mbox_filename)
     >>> mbox = UnixMailbox(mbox_file)
-    >>> msg = mbox.next()
+    >>> msg = next(mbox)
     >>> msg['from']
     'sting@xxxxxxxxxxx'
-    >>> msg = mbox.next()
+    >>> msg = next(mbox)
 
     >>> mbox_file = open(chained_filename)
     >>> mbox = UnixMailbox(mbox_file)
-    >>> msg = mbox.next()
+    >>> msg = next(mbox)
     >>> msg['from']
     'sting@xxxxxxxxxxx'
-    >>> msg = mbox.next()
+    >>> msg = next(mbox)
diff --git a/lib/lp/services/tests/test_utils.py b/lib/lp/services/tests/test_utils.py
index dd50c8f..e753a82 100644
--- a/lib/lp/services/tests/test_utils.py
+++ b/lib/lp/services/tests/test_utils.py
@@ -201,8 +201,8 @@ class TestCachingIterator(TestCase):
         ci = CachingIterator(partial(iter, [0, 1, 2, 3, 4]))
         i1 = iter(ci)
         i2 = iter(ci)
-        self.assertEqual(0, i1.next())
-        self.assertEqual(0, i2.next())
+        self.assertEqual(0, next(i1))
+        self.assertEqual(0, next(i2))
         self.assertEqual([1, 2, 3, 4], list(i2))
         self.assertEqual([1, 2, 3, 4], list(i1))
 
diff --git a/lib/lp/services/twistedsupport/tests/test_task.py b/lib/lp/services/twistedsupport/tests/test_task.py
index 40abcc7..a40a31d 100644
--- a/lib/lp/services/twistedsupport/tests/test_task.py
+++ b/lib/lp/services/twistedsupport/tests/test_task.py
@@ -4,6 +4,8 @@
 
 __metaclass__ = type
 
+from functools import partial
+
 from twisted.internet.defer import (
     Deferred,
     succeed,
@@ -193,7 +195,8 @@ class TestPollingTaskSource(TestCase):
             self.factory.getUniqueString(), self.factory.getUniqueString()]
         consumer1_tasks = []
         consumer2_tasks = []
-        task_source = self.makeTaskSource(task_producer=iter(tasks).next)
+        task_source = self.makeTaskSource(
+            task_producer=partial(next, iter(tasks)))
         task_source.start(AppendingTaskConsumer(consumer1_tasks))
         task_source.start(AppendingTaskConsumer(consumer2_tasks))
         self.assertEqual(
diff --git a/lib/lp/services/webapp/doc/canonical_url.txt b/lib/lp/services/webapp/doc/canonical_url.txt
index 6d3c75a..8a52aa7 100644
--- a/lib/lp/services/webapp/doc/canonical_url.txt
+++ b/lib/lp/services/webapp/doc/canonical_url.txt
@@ -333,19 +333,19 @@ We have to do the tests that involve errors bit by bit, to allow the doctest
 to work properly.
 
     >>> iterator = canonical_url_iterator(object_that_has_no_url)
-    >>> iterator.next().__class__.__name__
+    >>> next(iterator).__class__.__name__
     'object'
-    >>> iterator.next()
+    >>> next(iterator)
     Traceback (most recent call last):
     ...
     NoCanonicalUrl: No url for <...object...> because <...object...> broke the chain.
 
     >>> iterator = canonical_url_iterator(unrooted_object)
-    >>> iterator.next().__class__.__name__
+    >>> next(iterator).__class__.__name__
     'ObjectThatHasUrl'
-    >>> iterator.next().__class__.__name__
+    >>> next(iterator).__class__.__name__
     'object'
-    >>> iterator.next()
+    >>> next(iterator)
     Traceback (most recent call last):
     ...
     NoCanonicalUrl: No url for <...ObjectThatHasUrl...> because <...object...> broke the chain.
diff --git a/lib/lp/services/webapp/errorlog.py b/lib/lp/services/webapp/errorlog.py
index 2092e90..a64ce43 100644
--- a/lib/lp/services/webapp/errorlog.py
+++ b/lib/lp/services/webapp/errorlog.py
@@ -449,7 +449,7 @@ class ErrorReportingUtility:
         :param message: Unicode message.
         :returns: Key for this message.
         """
-        key = self._oops_message_key_iter.next()
+        key = next(self._oops_message_key_iter)
         self._oops_messages[key] = message
         return key
 
diff --git a/lib/lp/services/webapp/tests/test_authorization.py b/lib/lp/services/webapp/tests/test_authorization.py
index 5f5db72..8062473 100644
--- a/lib/lp/services/webapp/tests/test_authorization.py
+++ b/lib/lp/services/webapp/tests/test_authorization.py
@@ -489,7 +489,7 @@ class LoneObject(LaunchpadContainer):
 
     def __init__(self):
         super(LoneObject, self).__init__(self)
-        self.id = LoneObject._id_counter.next()
+        self.id = next(LoneObject._id_counter)
 
     def getParentContainers(self):
         return []
diff --git a/lib/lp/testing/__init__.py b/lib/lp/testing/__init__.py
index 85ffd79..20a50d9 100644
--- a/lib/lp/testing/__init__.py
+++ b/lib/lp/testing/__init__.py
@@ -1320,11 +1320,11 @@ def time_counter(origin=None, delta=timedelta(seconds=5)):
     by the delta.
 
     >>> now = time_counter(datetime(2007, 12, 1), timedelta(days=1))
-    >>> now.next()
+    >>> next(now)
     datetime.datetime(2007, 12, 1, 0, 0)
-    >>> now.next()
+    >>> next(now)
     datetime.datetime(2007, 12, 2, 0, 0)
-    >>> now.next()
+    >>> next(now)
     datetime.datetime(2007, 12, 3, 0, 0)
     """
     if origin is None:
diff --git a/lib/lp/testing/factory.py b/lib/lp/testing/factory.py
index 85a05b6..ff469d1 100644
--- a/lib/lp/testing/factory.py
+++ b/lib/lp/testing/factory.py
@@ -440,7 +440,7 @@ class ObjectFactory:
         For each thread, this will be a series of increasing numbers, but the
         starting point will be unique per thread.
         """
-        return ObjectFactory._unique_int_counter.next()
+        return next(ObjectFactory._unique_int_counter)
 
     def getUniqueHexString(self, digits=None):
         """Return a unique hexadecimal string.
@@ -1740,7 +1740,7 @@ class BareLaunchpadObjectFactory(ObjectFactory):
             revision = revision_set.new(
                 revision_id=self.getUniqueString('revision-id'),
                 log_body=self.getUniqueString('log-body'),
-                revision_date=date_generator.next(),
+                revision_date=next(date_generator),
                 revision_author=author,
                 parent_ids=parent_ids,
                 properties={})
@@ -2545,7 +2545,7 @@ class BareLaunchpadObjectFactory(ObjectFactory):
             # If a date_started is specified, then base the finish time
             # on that.
             if date_started is None:
-                date_finished = time_counter().next()
+                date_finished = next(time_counter())
             else:
                 date_finished = date_started + timedelta(hours=4)
         if date_started is None:
diff --git a/lib/lp/translations/browser/tests/test_translationmessage_view.py b/lib/lp/translations/browser/tests/test_translationmessage_view.py
index c196dc5..e7d7f88 100644
--- a/lib/lp/translations/browser/tests/test_translationmessage_view.py
+++ b/lib/lp/translations/browser/tests/test_translationmessage_view.py
@@ -9,6 +9,7 @@ from datetime import (
     datetime,
     timedelta,
     )
+from functools import partial
 
 import pytz
 from zope.component import getUtility
@@ -58,7 +59,7 @@ class TestCurrentTranslationMessage_can_dismiss(TestCaseWithFactory):
         self.pofile = self.factory.makePOFile(potemplate=self.potemplate)
         self.potmsgset = self.factory.makePOTMsgSet(self.potemplate)
         self.view = None
-        self.now = self._gen_now().next
+        self.now = partial(next, self._gen_now())
 
     def _createView(self, message):
         self.view = CurrentTranslationMessageView(
diff --git a/lib/lp/translations/tests/test_potmsgset.py b/lib/lp/translations/tests/test_potmsgset.py
index c5aaae5..9ea5cc6 100644
--- a/lib/lp/translations/tests/test_potmsgset.py
+++ b/lib/lp/translations/tests/test_potmsgset.py
@@ -7,6 +7,7 @@ from datetime import (
     datetime,
     timedelta,
     )
+from functools import partial
 
 import pytz
 import transaction
@@ -648,7 +649,7 @@ class TestPOTMsgSetSuggestions(TestCaseWithFactory):
         # Create a product with all the boilerplate objects to be able to
         # create TranslationMessage objects.
         super(TestPOTMsgSetSuggestions, self).setUp('carlos@xxxxxxxxxxxxx')
-        self.now = self.gen_now().next
+        self.now = partial(next, self.gen_now())
         self.foo = self.factory.makeProduct(
             translations_usage=ServiceUsage.LAUNCHPAD)
         self.foo_main = self.factory.makeProductSeries(
@@ -846,7 +847,7 @@ class TestPOTMsgSetResetTranslation(TestCaseWithFactory):
         # create TranslationMessage objects.
         super(TestPOTMsgSetResetTranslation, self).setUp(
             'carlos@xxxxxxxxxxxxx')
-        self.now = self.gen_now().next
+        self.now = partial(next, self.gen_now())
         self.foo = self.factory.makeProduct(
             translations_usage=ServiceUsage.LAUNCHPAD)
         self.foo_main = self.factory.makeProductSeries(

Follow ups