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

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 7f354e612a7693109ff83a088f0a78ae982765b1
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:next-builtin
Merge into: launchpad:master
Diff against target: 1153 lines (+128/-119)
51 files modified
lib/lp/answers/doc/karma.txt (+10/-10)
lib/lp/answers/tests/emailinterface.txt (+3/-3)
lib/lp/app/browser/launchpad.py (+2/-2)
lib/lp/bugs/browser/tests/test_cve.py (+2/-1)
lib/lp/bugs/browser/widgets/bugtask.py (+1/-1)
lib/lp/bugs/doc/bugcomment.txt (+1/-1)
lib/lp/bugs/externalbugtracker/mantis.py (+1/-1)
lib/lp/bugs/externalbugtracker/roundup.py (+1/-1)
lib/lp/bugs/externalbugtracker/trac.py (+1/-1)
lib/lp/bugs/scripts/debbugs.py (+4/-2)
lib/lp/bugs/scripts/tests/test_bugnotification.py (+6/-6)
lib/lp/code/browser/sourcepackagerecipe.py (+1/-1)
lib/lp/code/browser/tests/test_branchlisting.py (+2/-2)
lib/lp/code/browser/tests/test_branchmergeproposal.py (+2/-2)
lib/lp/code/browser/tests/test_sourcepackagerecipe.py (+6/-6)
lib/lp/code/doc/branch.txt (+1/-1)
lib/lp/code/doc/codeimport-result.txt (+3/-3)
lib/lp/code/model/branchnamespace.py (+1/-1)
lib/lp/code/model/gitlookup.py (+2/-2)
lib/lp/code/model/tests/test_branchcloud.py (+1/-1)
lib/lp/code/model/tests/test_codeimport.py (+6/-6)
lib/lp/code/model/tests/test_revision.py (+4/-4)
lib/lp/code/model/tests/test_revisioncache.py (+2/-2)
lib/lp/code/stories/branches/xx-personproduct-branch-listings.txt (+4/-4)
lib/lp/code/stories/feeds/xx-branch-atom.txt (+1/-1)
lib/lp/code/stories/feeds/xx-revision-atom.txt (+1/-1)
lib/lp/code/tests/codeimporthelpers.py (+1/-1)
lib/lp/code/tests/helpers.py (+3/-3)
lib/lp/code/vocabularies/branch.py (+1/-1)
lib/lp/code/vocabularies/gitrepository.py (+1/-1)
lib/lp/codehosting/scanner/mergedetection.py (+1/-1)
lib/lp/codehosting/sftp.py (+5/-4)
lib/lp/codehosting/vfs/tests/test_branchfs.py (+1/-1)
lib/lp/registry/doc/person-merge.txt (+4/-4)
lib/lp/registry/doc/standing.txt (+1/-1)
lib/lp/registry/tests/test_milestonetag.py (+1/-1)
lib/lp/services/apachelogparser/base.py (+1/-1)
lib/lp/services/doc/propertycache.txt (+1/-1)
lib/lp/services/gpg/tests/test_gpghandler.py (+1/-1)
lib/lp/services/librarianserver/swift.py (+1/-1)
lib/lp/services/mail/tests/mbox_mailer.txt (+10/-10)
lib/lp/services/tests/test_utils.py (+2/-2)
lib/lp/services/twistedsupport/tests/test_task.py (+4/-1)
lib/lp/services/webapp/doc/canonical_url.txt (+5/-5)
lib/lp/services/webapp/errorlog.py (+1/-1)
lib/lp/services/webapp/servers.py (+2/-2)
lib/lp/services/webapp/tests/test_authorization.py (+1/-1)
lib/lp/testing/__init__.py (+3/-3)
lib/lp/testing/factory.py (+3/-3)
lib/lp/translations/browser/tests/test_translationmessage_view.py (+2/-1)
lib/lp/translations/tests/test_potmsgset.py (+3/-2)
Reviewer Review Type Date Requested Status
Thiago F. Pappacena (community) Approve
Review via email: mp+380096@code.launchpad.net

Commit message

Use next(iterator) rather than iterator.next()

To post a comment you must log in.
Revision history for this message
Thiago F. Pappacena (pappacena) :
Revision history for this message
Thiago F. Pappacena (pappacena) wrote :

Added a simple comment, but nothing that blocks this MP.

review: Approve
~cjwatson/launchpad:next-builtin updated
7f354e6... by Colin Watson

Handle Python 3 iterator protocol changes

We now define `__next__` rather than `next`, and use six.Iterator to
smooth over compatibility issues.

Revision history for this message
Colin Watson (cjwatson) :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
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
64 >>> firefox = getUtility(IProductSet)['firefox']64 >>> firefox = getUtility(IProductSet)['firefox']
65 >>> firefox_question = firefox.newQuestion(65 >>> firefox_question = firefox.newQuestion(
66 ... title='New question', description='Question description.',66 ... title='New question', description='Question description.',
67 ... owner=sample_person, datecreated=now.next())67 ... owner=sample_person, datecreated=next(now))
68 Karma added: action=questionasked, product=firefox, person=name1268 Karma added: action=questionasked, product=firefox, person=name12
6969
7070
@@ -77,7 +77,7 @@ will usually be called by an automated script.
77 >>> msg = firefox_question.expireQuestion(77 >>> msg = firefox_question.expireQuestion(
78 ... foo_bar, 'Expiring because of inactivity. Reopen if you are '78 ... foo_bar, 'Expiring because of inactivity. Reopen if you are '
79 ... 'still having the problem and provide additional information.',79 ... 'still having the problem and provide additional information.',
80 ... datecreated=now.next())80 ... datecreated=next(now))
8181
8282
83Reopening a question83Reopening a question
@@ -85,7 +85,7 @@ Reopening a question
8585
86 >>> msg = firefox_question.reopen(86 >>> msg = firefox_question.reopen(
87 ... "Firefox doesn't have any 'Quick Searches' in its bookmarks.",87 ... "Firefox doesn't have any 'Quick Searches' in its bookmarks.",
88 ... datecreated=now.next())88 ... datecreated=next(now))
89 Karma added: action=questionreopened, product=firefox, person=name1289 Karma added: action=questionreopened, product=firefox, person=name12
9090
9191
@@ -94,7 +94,7 @@ Requesting for more information
9494
95 >>> msg = firefox_question.requestInfo(95 >>> msg = firefox_question.requestInfo(
96 ... foo_bar, 'What "Quick Searches" do you want?',96 ... foo_bar, 'What "Quick Searches" do you want?',
97 ... datecreated=now.next())97 ... datecreated=next(now))
98 Karma added: action=questionrequestedinfo, product=firefox, person=name1698 Karma added: action=questionrequestedinfo, product=firefox, person=name16
9999
100100
@@ -103,7 +103,7 @@ Giving back more information
103103
104 >>> msg = firefox_question.giveInfo(104 >>> msg = firefox_question.giveInfo(
105 ... 'The same one than shipped upstreams.',105 ... 'The same one than shipped upstreams.',
106 ... datecreated=now.next())106 ... datecreated=next(now))
107 Karma added: action=questiongaveinfo, product=firefox, person=name12107 Karma added: action=questiongaveinfo, product=firefox, person=name12
108108
109109
@@ -112,7 +112,7 @@ Giving an answer to a question
112112
113 >>> msg = firefox_question.giveAnswer(113 >>> msg = firefox_question.giveAnswer(
114 ... foo_bar, "Ok, I see what you mean. You need to install them "114 ... foo_bar, "Ok, I see what you mean. You need to install them "
115 ... "manually for now.", datecreated=now.next())115 ... "manually for now.", datecreated=next(now))
116 Karma added: action=questiongaveanswer, product=firefox, person=name16116 Karma added: action=questiongaveanswer, product=firefox, person=name16
117117
118118
@@ -121,7 +121,7 @@ Adding a comment
121121
122 >>> msg = firefox_question.addComment(122 >>> msg = firefox_question.addComment(
123 ... foo_bar, 'You could also fill a bug about that, if you like.',123 ... foo_bar, 'You could also fill a bug about that, if you like.',
124 ... datecreated=now.next())124 ... datecreated=next(now))
125 Karma added: action=questioncommentadded, product=firefox, person=name16125 Karma added: action=questioncommentadded, product=firefox, person=name16
126126
127127
@@ -134,7 +134,7 @@ receives karma.
134134
135 >>> msg = firefox_question.confirmAnswer(135 >>> msg = firefox_question.confirmAnswer(
136 ... "Ok, thanks. I'll open a bug about this then.",136 ... "Ok, thanks. I'll open a bug about this then.",
137 ... answer=msg, datecreated=now.next())137 ... answer=msg, datecreated=next(now))
138 Karma added: action=questionansweraccepted, product=firefox, person=name12138 Karma added: action=questionansweraccepted, product=firefox, person=name12
139 Karma added: action=questionanswered, product=firefox, person=name16139 Karma added: action=questionanswered, product=firefox, person=name16
140140
@@ -156,7 +156,7 @@ We do not grant karma for status change made outside of workflow:
156 >>> from lp.answers.enums import QuestionStatus156 >>> from lp.answers.enums import QuestionStatus
157 >>> msg = firefox_question.setStatus(157 >>> msg = firefox_question.setStatus(
158 ... foo_bar, QuestionStatus.OPEN, 'That rejection was an error.',158 ... foo_bar, QuestionStatus.OPEN, 'That rejection was an error.',
159 ... datecreated=now.next())159 ... datecreated=next(now))
160160
161161
162Changing the title of a question162Changing the title of a question
@@ -205,7 +205,7 @@ persons who were awarded it in the past.
205 >>> msg = firefox_question.giveAnswer(205 >>> msg = firefox_question.giveAnswer(
206 ... sample_person, "I was able to import some by following the "206 ... sample_person, "I was able to import some by following the "
207 ... "instructions on http://tinyurl.com/cyus4",207 ... "instructions on http://tinyurl.com/cyus4",
208 ... datecreated=now.next())208 ... datecreated=next(now))
209209
210210
211Creating a FAQ211Creating 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.
38 ... lines = ['From: %s' % from_addr]38 ... lines = ['From: %s' % from_addr]
39 ... to_addr = 'question%s@answers.launchpad.net' % question_id39 ... to_addr = 'question%s@answers.launchpad.net' % question_id
40 ... lines.append('To: %s' % to_addr)40 ... lines.append('To: %s' % to_addr)
41 ... date = mktime_tz(now.next().utctimetuple() + (0, ))41 ... date = mktime_tz(next(now).utctimetuple() + (0, ))
42 ... lines.append('Date: %s' % formatdate(date))42 ... lines.append('Date: %s' % formatdate(date))
43 ... msgid = make_msgid()43 ... msgid = make_msgid()
44 ... lines.append('Message-Id: %s' % msgid)44 ... lines.append('Message-Id: %s' % msgid)
@@ -116,7 +116,7 @@ possibilities for the user.
116 ... question = ubuntu.newQuestion(116 ... question = ubuntu.newQuestion(
117 ... no_priv, 'Unable to boot installer',117 ... no_priv, 'Unable to boot installer',
118 ... "I've tried installing Ubuntu on a Mac. But the installer "118 ... "I've tried installing Ubuntu on a Mac. But the installer "
119 ... "never boots.", datecreated=now.next())119 ... "never boots.", datecreated=next(now))
120 ... question_id = question.id120 ... question_id = question.id
121121
122 # We need to refetch the question, since a new transaction was started.122 # We need to refetch the question, since a new transaction was started.
@@ -127,7 +127,7 @@ possibilities for the user.
127 >>> def setQuestionStatus(question, new_status):127 >>> def setQuestionStatus(question, new_status):
128 ... login('foo.bar@canonical.com')128 ... login('foo.bar@canonical.com')
129 ... question.setStatus(foo_bar, new_status, 'Status Change',129 ... question.setStatus(foo_bar, new_status, 'Status Change',
130 ... datecreated=now.next())130 ... datecreated=next(now))
131 ... login('no-priv@canonical.com')131 ... login('no-priv@canonical.com')
132132
133Message From the Question Owner133Message 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):
271 """The objects for which we want breadcrumbs."""271 """The objects for which we want breadcrumbs."""
272 # Start the chain with the deepest object that has a breadcrumb.272 # Start the chain with the deepest object that has a breadcrumb.
273 try:273 try:
274 objects = [(274 objects = [next((
275 obj for obj in reversed(self.request.traversed_objects)275 obj for obj in reversed(self.request.traversed_objects)
276 if IBreadcrumb(obj, None)).next()]276 if IBreadcrumb(obj, None)))]
277 except StopIteration:277 except StopIteration:
278 return []278 return []
279 # Now iterate. If an object has a breadcrumb, it can override279 # 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 @@
33
4"""CVE related tests."""4"""CVE related tests."""
55
6from functools import partial
6from operator import attrgetter7from operator import attrgetter
7import re8import re
89
@@ -35,7 +36,7 @@ class TestCVEReportView(TestCaseWithFactory):
35 self.resolved_bugtasks = []36 self.resolved_bugtasks = []
36 self.unresolved_bugtasks = []37 self.unresolved_bugtasks = []
37 self.cves = {}38 self.cves = {}
38 self.getCVE = self.cveGenerator().next39 self.getCVE = partial(next, self.cveGenerator())
39 with person_logged_in(distroseries.owner):40 with person_logged_in(distroseries.owner):
40 for status in RESOLVED_BUGTASK_STATUSES:41 for status in RESOLVED_BUGTASK_STATUSES:
41 tasks, cves = self.makeBugTasksWithCve(status, distroseries)42 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):
384 and len(self.vocabulary) > 0384 and len(self.vocabulary) > 0
385 and self.context.required):385 and self.context.required):
386 # Grab the first item from the iterator:386 # Grab the first item from the iterator:
387 values = [iter(self.vocabulary).next().value]387 values = [next(iter(self.vocabulary)).value]
388 elif value != self.context.missing_value:388 elif value != self.context.missing_value:
389 values = [value]389 values = [value]
390 else:390 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.
270 >>> def add_comments(bug, how_many):270 >>> def add_comments(bug, how_many):
271 ... bug_message_set = getUtility(IBugMessageSet)271 ... bug_message_set = getUtility(IBugMessageSet)
272 ... for i in range(how_many):272 ... for i in range(how_many):
273 ... num = comment_counter.next()273 ... num = next(comment_counter)
274 ... bug_message_set.createMessage(274 ... bug_message_set.createMessage(
275 ... "Comment %d" % num, bug, bug.owner,275 ... "Comment %d" % num, bug, bug.owner,
276 ... "Something or other #%d" % num)276 ... "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:
140 # it because different Mantis instances have different header140 # it because different Mantis instances have different header
141 # ordering and even different columns in the export.141 # ordering and even different columns in the export.
142 try:142 try:
143 headers = [h.lower() for h in reader.next()]143 headers = [h.lower() for h in next(reader)]
144 except StopIteration:144 except StopIteration:
145 raise UnparsableBugData("Missing header line")145 raise UnparsableBugData("Missing header line")
146 missing_headers = [146 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):
219 bug_id = int(bug_id)219 bug_id = int(bug_id)
220 query_url = self.getSingleBugExportURL(bug_id)220 query_url = self.getSingleBugExportURL(bug_id)
221 reader = csv.DictReader(self._getPage(query_url).iter_lines())221 reader = csv.DictReader(self._getPage(query_url).iter_lines())
222 return (bug_id, reader.next())222 return (bug_id, next(reader))
223223
224 def getRemoteBugBatch(self, bug_ids):224 def getRemoteBugBatch(self, bug_ids):
225 """See `ExternalBugTracker`"""225 """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):
151 # We read the remote bugs into a list so that we can check that151 # We read the remote bugs into a list so that we can check that
152 # the data we're getting back from the remote server are valid.152 # the data we're getting back from the remote server are valid.
153 csv_reader = csv.DictReader(self._getPage(query_url).iter_lines())153 csv_reader = csv.DictReader(self._getPage(query_url).iter_lines())
154 remote_bugs = [csv_reader.next()]154 remote_bugs = [next(csv_reader)]
155155
156 # We consider the data we're getting from the remote server to156 # We consider the data we're getting from the remote server to
157 # be valid if there is an ID field and a status field in the CSV157 # be valid if there is an ID field and a status field in the CSV
diff --git a/lib/lp/bugs/scripts/debbugs.py b/lib/lp/bugs/scripts/debbugs.py
index c632743..90de42f 100644
--- a/lib/lp/bugs/scripts/debbugs.py
+++ b/lib/lp/bugs/scripts/debbugs.py
@@ -8,6 +8,8 @@ import os
8import re8import re
9import subprocess9import subprocess
1010
11import six
12
1113
12class Bug:14class Bug:
13 def __init__(self, db, id, package=None, date=None, status=None,15 def __init__(self, db, id, package=None, date=None, status=None,
@@ -97,7 +99,7 @@ class Database:
97 self.debbugs_pl = debbugs_pl99 self.debbugs_pl = debbugs_pl
98 self.subdir = subdir100 self.subdir = subdir
99101
100 class bug_iterator:102 class bug_iterator(six.Iterator):
101 index_record = re.compile(103 index_record = re.compile(
102 r'^(?P<package>\S+) (?P<bugid>\d+) (?P<date>\d+) (?P<status>\w+) '104 r'^(?P<package>\S+) (?P<bugid>\d+) (?P<date>\d+) (?P<status>\w+) '
103 r'\[(?P<originator>.*)\] (?P<severity>\w+)(?: (?P<tags>.*))?$')105 r'\[(?P<originator>.*)\] (?P<severity>\w+)(?: (?P<tags>.*))?$')
@@ -107,7 +109,7 @@ class Database:
107 self.index = open(os.path.join(self.db.root, 'index/index.db'))109 self.index = open(os.path.join(self.db.root, 'index/index.db'))
108 self.filter = filter110 self.filter = filter
109111
110 def next(self):112 def __next__(self):
111 line = self.index.readline()113 line = self.index.readline()
112 if not line:114 if not line:
113 raise StopIteration115 raise StopIteration
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):
427 # Now we create the generator, start it, and then close it, triggering427 # Now we create the generator, start it, and then close it, triggering
428 # a GeneratorExit exception inside the generator.428 # a GeneratorExit exception inside the generator.
429 email_notifications = get_email_notifications(notifications)429 email_notifications = get_email_notifications(notifications)
430 email_notifications.next()430 next(email_notifications)
431 email_notifications.close()431 email_notifications.close()
432432
433 # Verify that no "Error while building email notifications." is logged.433 # Verify that no "Error while building email notifications." is logged.
@@ -706,7 +706,7 @@ class EmailNotificationsBugMixin:
706 def test_change_seen(self):706 def test_change_seen(self):
707 # A smoketest.707 # A smoketest.
708 self.change(self.old, self.new)708 self.change(self.old, self.new)
709 message, body = self.get_messages().next()709 message, body = next(self.get_messages())
710 self.assertThat(body, Contains(self.unexpected_text))710 self.assertThat(body, Contains(self.unexpected_text))
711711
712 def test_undone_change_sends_no_emails(self):712 def test_undone_change_sends_no_emails(self):
@@ -718,7 +718,7 @@ class EmailNotificationsBugMixin:
718 self.change(self.old, self.new)718 self.change(self.old, self.new)
719 self.change(self.new, self.old)719 self.change(self.new, self.old)
720 self.change_other()720 self.change_other()
721 message, body = self.get_messages().next()721 message, body = next(self.get_messages())
722 self.assertThat(body, Not(Contains(self.unexpected_text)))722 self.assertThat(body, Not(Contains(self.unexpected_text)))
723723
724 def test_multiple_undone_changes_sends_no_emails(self):724 def test_multiple_undone_changes_sends_no_emails(self):
@@ -761,7 +761,7 @@ class EmailNotificationsBugTaskMixin(EmailNotificationsBugMixin):
761 self.bug.addTask(self.product_owner, product2)761 self.bug.addTask(self.product_owner, product2)
762 self.change(self.old, self.new, index=0)762 self.change(self.old, self.new, index=0)
763 self.change(self.new, self.old, index=1)763 self.change(self.new, self.old, index=1)
764 message, body = self.get_messages().next()764 message, body = next(self.get_messages())
765 self.assertThat(body, Contains(self.unexpected_text))765 self.assertThat(body, Contains(self.unexpected_text))
766766
767767
@@ -775,7 +775,7 @@ class EmailNotificationsAddedRemovedMixin:
775775
776 def test_added_seen(self):776 def test_added_seen(self):
777 self.add(self.old)777 self.add(self.old)
778 message, body = self.get_messages().next()778 message, body = next(self.get_messages())
779 self.assertThat(body, Contains(self.added_message))779 self.assertThat(body, Contains(self.added_message))
780780
781 def test_added_removed_sends_no_emails(self):781 def test_added_removed_sends_no_emails(self):
@@ -791,7 +791,7 @@ class EmailNotificationsAddedRemovedMixin:
791 def test_added_another_removed_sends_emails(self):791 def test_added_another_removed_sends_emails(self):
792 self.add(self.old)792 self.add(self.old)
793 self.remove(self.new)793 self.remove(self.new)
794 message, body = self.get_messages().next()794 message, body = next(self.get_messages())
795 self.assertThat(body, Contains(self.added_message))795 self.assertThat(body, Contains(self.added_message))
796 self.assertThat(body, Contains(self.removed_message))796 self.assertThat(body, Contains(self.removed_message))
797797
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,
755 yield "%s-daily" % branch_target_name755 yield "%s-daily" % branch_target_name
756 counter = itertools.count(1)756 counter = itertools.count(1)
757 while True:757 while True:
758 yield "%s-daily-%s" % (branch_target_name, counter.next())758 yield "%s-daily-%s" % (branch_target_name, next(counter))
759759
760 def _find_unused_name(self, owner):760 def _find_unused_name(self, owner):
761 # Grab the last path element of the branch target path.761 # 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,
123 self.branches = [123 self.branches = [
124 self.factory.makeProductBranch(124 self.factory.makeProductBranch(
125 product=self.bambam, owner=self.barney,125 product=self.bambam, owner=self.barney,
126 date_created=time_gen.next())126 date_created=next(time_gen))
127 for i in range(10)]127 for i in range(10)]
128 self.bug = self.factory.makeBug()128 self.bug = self.factory.makeBug()
129 self.bug.linkBranch(self.branches[0], self.barney)129 self.bug.linkBranch(self.branches[0], self.barney)
@@ -459,7 +459,7 @@ class TestGroupedDistributionSourcePackageBranchesView(TestCaseWithFactory):
459 self.factory.makePackageBranch(459 self.factory.makePackageBranch(
460 distroseries=distroseries,460 distroseries=distroseries,
461 sourcepackagename=self.sourcepackagename,461 sourcepackagename=self.sourcepackagename,
462 date_created=time_gen.next())462 date_created=next(time_gen))
463 for i in range(branch_count)]463 for i in range(branch_count)]
464464
465 official = []465 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):
322 owner=reviewer,322 owner=reviewer,
323 subject=self.factory.getUniqueString('subject'),323 subject=self.factory.getUniqueString('subject'),
324 vote=vote,324 vote=vote,
325 _date_created=self.date_generator.next())325 _date_created=next(self.date_generator))
326326
327 def _nominateReviewer(self, reviewer, registrant):327 def _nominateReviewer(self, reviewer, registrant):
328 """Nominate a reviewer for the merge proposal."""328 """Nominate a reviewer for the merge proposal."""
329 self.bmp.nominateReviewer(329 self.bmp.nominateReviewer(
330 reviewer=reviewer, registrant=registrant,330 reviewer=reviewer, registrant=registrant,
331 _date_created=self.date_generator.next())331 _date_created=next(self.date_generator))
332332
333 def testNoVotes(self):333 def testNoVotes(self):
334 # No votes should return empty lists334 # 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:
1362 # use id as the ordering attribute and lower ids mean created earlier.1362 # use id as the ordering attribute and lower ids mean created earlier.
1363 date_gen = time_counter(1363 date_gen = time_counter(
1364 datetime(2010, 3, 16, tzinfo=UTC), timedelta(days=1))1364 datetime(2010, 3, 16, tzinfo=UTC), timedelta(days=1))
1365 build1 = self.makeBuildJob(recipe, date_gen.next())1365 build1 = self.makeBuildJob(recipe, next(date_gen))
1366 build2 = self.makeBuildJob(recipe, date_gen.next())1366 build2 = self.makeBuildJob(recipe, next(date_gen))
1367 build3 = self.makeBuildJob(recipe, date_gen.next())1367 build3 = self.makeBuildJob(recipe, next(date_gen))
1368 build4 = self.makeBuildJob(recipe, date_gen.next())1368 build4 = self.makeBuildJob(recipe, next(date_gen))
1369 build5 = self.makeBuildJob(recipe, date_gen.next())1369 build5 = self.makeBuildJob(recipe, next(date_gen))
1370 build6 = self.makeBuildJob(recipe, date_gen.next())1370 build6 = self.makeBuildJob(recipe, next(date_gen))
1371 view = SourcePackageRecipeView(recipe, None)1371 view = SourcePackageRecipeView(recipe, None)
1372 self.assertEqual(1372 self.assertEqual(
1373 [build6, build5, build4, build3, build2, build1],1373 [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.
193 ... """Create """193 ... """Create """
194 ... new_branch = factory.makeProductBranch(194 ... new_branch = factory.makeProductBranch(
195 ... branch_type=branch_type, owner=owner, product=product,195 ... branch_type=branch_type, owner=owner, product=product,
196 ... name=name, date_created=time_generator.next())196 ... name=name, date_created=next(time_generator))
197 ... new_branch.last_scanned = new_branch.date_created197 ... new_branch.last_scanned = new_branch.date_created
198198
199 >>> make_new_scanned_branch('oldest')199 >>> 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.
53 >>> from lp.code.enums import CodeImportResultStatus53 >>> from lp.code.enums import CodeImportResultStatus
54 >>> new_result = factory.makeCodeImportResult(54 >>> new_result = factory.makeCodeImportResult(
55 ... sample_import, result_status=CodeImportResultStatus.SUCCESS,55 ... sample_import, result_status=CodeImportResultStatus.SUCCESS,
56 ... date_started=time_source.next(), log_excerpt=log_excerpt,56 ... date_started=next(time_source), log_excerpt=log_excerpt,
57 ... log_alias=log_alias, machine=odin)57 ... log_alias=log_alias, machine=odin)
58 >>> verifyObject(ICodeImportResult, new_result)58 >>> verifyObject(ICodeImportResult, new_result)
59 True59 True
@@ -95,9 +95,9 @@ method works as expected.
9595
96 >>> oldest_result = new_result96 >>> oldest_result = new_result
97 >>> middle_result = factory.makeCodeImportResult(97 >>> middle_result = factory.makeCodeImportResult(
98 ... sample_import, date_started = time_source.next())98 ... sample_import, date_started = next(time_source))
99 >>> newest_result = factory.makeCodeImportResult(99 >>> newest_result = factory.makeCodeImportResult(
100 ... sample_import, date_started = time_source.next())100 ... sample_import, date_started = next(time_source))
101101
102Results for other imports of course should not be present in the102Results for other imports of course should not be present in the
103results, so we should create one of those just to be sure that it's103results, 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:
489489
490 def get_next_segment():490 def get_next_segment():
491 try:491 try:
492 result = segments.next()492 result = next(segments)
493 except StopIteration:493 except StopIteration:
494 raise InvalidNamespace('/'.join(traversed_segments))494 raise InvalidNamespace('/'.join(traversed_segments))
495 if result is None:495 if result is None:
diff --git a/lib/lp/code/model/gitlookup.py b/lib/lp/code/model/gitlookup.py
index 9c01af4..29efe5f 100644
--- a/lib/lp/code/model/gitlookup.py
+++ b/lib/lp/code/model/gitlookup.py
@@ -255,14 +255,14 @@ class DistributionOCIProjectGitTraversable(_BaseGitTraversable):
255 ociprojectname=self.context.ociprojectname)255 ociprojectname=self.context.ociprojectname)
256256
257257
258class SegmentIterator:258class SegmentIterator(six.Iterator):
259 """An iterator that remembers the elements it has traversed."""259 """An iterator that remembers the elements it has traversed."""
260260
261 def __init__(self, iterator):261 def __init__(self, iterator):
262 self._iterator = iterator262 self._iterator = iterator
263 self.traversed = []263 self.traversed = []
264264
265 def next(self):265 def __next__(self):
266 segment = six.ensure_text(next(self._iterator), encoding="US-ASCII")266 segment = six.ensure_text(next(self._iterator), encoding="US-ASCII")
267 self.traversed.append(segment)267 self.traversed.append(segment)
268 return segment268 return segment
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):
119 store = Store.of(product)119 store = Store.of(product)
120 for i in range(4):120 for i in range(4):
121 revision = self.factory.makeRevision(121 revision = self.factory.makeRevision(
122 revision_date=date_generator.next())122 revision_date=next(date_generator))
123 cache = RevisionCache(revision)123 cache = RevisionCache(revision)
124 cache.product = product124 cache.product = product
125 store.add(cache)125 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):
532 origin=datetime(2007, 9, 9, 12, tzinfo=pytz.UTC),532 origin=datetime(2007, 9, 9, 12, tzinfo=pytz.UTC),
533 delta=timedelta(days=1))533 delta=timedelta(days=1))
534 first = self.factory.makeCodeImportResult(534 first = self.factory.makeCodeImportResult(
535 self.code_import, date_started=when.next())535 self.code_import, date_started=next(when))
536 second = self.factory.makeCodeImportResult(536 second = self.factory.makeCodeImportResult(
537 self.code_import, date_started=when.next())537 self.code_import, date_started=next(when))
538 third = self.factory.makeCodeImportResult(538 third = self.factory.makeCodeImportResult(
539 self.code_import, date_started=when.next())539 self.code_import, date_started=next(when))
540 self.assertTrue(first.date_job_started < second.date_job_started)540 self.assertTrue(first.date_job_started < second.date_job_started)
541 self.assertTrue(second.date_job_started < third.date_job_started)541 self.assertTrue(second.date_job_started < third.date_job_started)
542 results = list(self.code_import.results)542 results = list(self.code_import.results)
@@ -552,11 +552,11 @@ class TestCodeImportResultsAttribute(TestCodeImportBase):
552 origin=datetime(2007, 9, 11, 12, tzinfo=pytz.UTC),552 origin=datetime(2007, 9, 11, 12, tzinfo=pytz.UTC),
553 delta=timedelta(days=-1))553 delta=timedelta(days=-1))
554 first = self.factory.makeCodeImportResult(554 first = self.factory.makeCodeImportResult(
555 self.code_import, date_started=when.next())555 self.code_import, date_started=next(when))
556 second = self.factory.makeCodeImportResult(556 second = self.factory.makeCodeImportResult(
557 self.code_import, date_started=when.next())557 self.code_import, date_started=next(when))
558 third = self.factory.makeCodeImportResult(558 third = self.factory.makeCodeImportResult(
559 self.code_import, date_started=when.next())559 self.code_import, date_started=next(when))
560 self.assertTrue(first.date_job_started > second.date_job_started)560 self.assertTrue(first.date_job_started > second.date_job_started)
561 self.assertTrue(second.date_job_started > third.date_job_started)561 self.assertTrue(second.date_job_started > third.date_job_started)
562 results = list(self.code_import.results)562 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):
369 def _makeRevision(self, revision_date=None):369 def _makeRevision(self, revision_date=None):
370 """Make a revision using the date generator."""370 """Make a revision using the date generator."""
371 if revision_date is None:371 if revision_date is None:
372 revision_date = self.date_generator.next()372 revision_date = next(self.date_generator)
373 return self.factory.makeRevision(373 return self.factory.makeRevision(
374 revision_date=revision_date)374 revision_date=revision_date)
375375
@@ -477,7 +477,7 @@ class TestGetPublicRevisionsForPerson(GetPublicRevisionsTestCase,
477477
478 `author` defaults to self.author if not set."""478 `author` defaults to self.author if not set."""
479 if revision_date is None:479 if revision_date is None:
480 revision_date = self.date_generator.next()480 revision_date = next(self.date_generator)
481 if author is None:481 if author is None:
482 author = self.author482 author = self.author
483 return self.factory.makeRevision(483 return self.factory.makeRevision(
@@ -955,7 +955,7 @@ class TestPruneRevisionCache(RevisionCacheTestCase):
955 delta=timedelta(days=2))955 delta=timedelta(days=2))
956 for i in range(4):956 for i in range(4):
957 revision = self.factory.makeRevision(957 revision = self.factory.makeRevision(
958 revision_date=date_generator.next())958 revision_date=next(date_generator))
959 cache = RevisionCache(revision)959 cache = RevisionCache(revision)
960 self.store.add(cache)960 self.store.add(cache)
961 RevisionSet.pruneRevisionCache(5)961 RevisionSet.pruneRevisionCache(5)
@@ -968,7 +968,7 @@ class TestPruneRevisionCache(RevisionCacheTestCase):
968 delta=timedelta(days=2))968 delta=timedelta(days=2))
969 for i in range(4):969 for i in range(4):
970 revision = self.factory.makeRevision(970 revision = self.factory.makeRevision(
971 revision_date=date_generator.next())971 revision_date=next(date_generator))
972 cache = RevisionCache(revision)972 cache = RevisionCache(revision)
973 self.store.add(cache)973 self.store.add(cache)
974 RevisionSet.pruneRevisionCache(1)974 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):
114 # query is the reverse order.114 # query is the reverse order.
115 revisions = [115 revisions = [
116 self.makeCachedRevision(116 self.makeCachedRevision(
117 revision=self.factory.makeRevision(revision_date=tc.next()))117 revision=self.factory.makeRevision(revision_date=next(tc)))
118 for i in range(4)]118 for i in range(4)]
119 revisions.reverse()119 revisions.reverse()
120 cache = getUtility(IRevisionCache)120 cache = getUtility(IRevisionCache)
@@ -142,7 +142,7 @@ class TestRevisionCache(TestCaseWithFactory):
142 # Make four cached revisions spanning 33, 31, 29, and 27 days ago.142 # Make four cached revisions spanning 33, 31, 29, and 27 days ago.
143 for i in range(4):143 for i in range(4):
144 self.makeCachedRevision(144 self.makeCachedRevision(
145 revision=self.factory.makeRevision(revision_date=tc.next()))145 revision=self.factory.makeRevision(revision_date=next(tc)))
146 cache = getUtility(IRevisionCache)146 cache = getUtility(IRevisionCache)
147 self.assertEqual(2, cache.count())147 self.assertEqual(2, cache.count())
148148
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.
27 ... datetime(2007, 12, 1, tzinfo=pytz.UTC), timedelta(days=1))27 ... datetime(2007, 12, 1, tzinfo=pytz.UTC), timedelta(days=1))
28 >>> branch = factory.makeProductBranch(28 >>> branch = factory.makeProductBranch(
29 ... owner=eric, product=fooix, name="testing",29 ... owner=eric, product=fooix, name="testing",
30 ... date_created=date_generator.next())30 ... date_created=next(date_generator))
31 >>> branch = factory.makeProductBranch(31 >>> branch = factory.makeProductBranch(
32 ... owner=eric, product=fooix, name="feature",32 ... owner=eric, product=fooix, name="feature",
33 ... date_created=date_generator.next())33 ... date_created=next(date_generator))
34 >>> branch = factory.makeAnyBranch(34 >>> branch = factory.makeAnyBranch(
35 ... owner=eric, date_created=date_generator.next())35 ... owner=eric, date_created=next(date_generator))
36 >>> branch = factory.makeAnyBranch(36 >>> branch = factory.makeAnyBranch(
37 ... owner=eric, date_created=date_generator.next())37 ... owner=eric, date_created=next(date_generator))
38 >>> logout()38 >>> logout()
3939
40 >>> browser.open('http://code.launchpad.test/~eric/fooix')40 >>> 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.
21 >>> def make_branch(owner, product, name):21 >>> def make_branch(owner, product, name):
22 ... global factory, date_generator22 ... global factory, date_generator
23 ... factory.makeProductBranch(name=name, product=product,23 ... factory.makeProductBranch(name=name, product=product,
24 ... owner=owner, date_created=date_generator.next())24 ... owner=owner, date_created=next(date_generator))
25 >>> mike = factory.makePerson(name='mike', displayname='Mike Murphy')25 >>> mike = factory.makePerson(name='mike', displayname='Mike Murphy')
26 >>> mary = factory.makePerson(name='mary', displayname='Mary Murphy')26 >>> mary = factory.makePerson(name='mary', displayname='Mary Murphy')
27 >>> projectgroup = factory.makeProject(name='oh-man', displayname='Oh Man')27 >>> 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.
37 ... global factory, date_generator37 ... global factory, date_generator
38 ... return factory.makeRevision(38 ... return factory.makeRevision(
39 ... author=removeSecurityProxy(author).preferredemail.email,39 ... author=removeSecurityProxy(author).preferredemail.email,
40 ... revision_date=date_generator.next(),40 ... revision_date=next(date_generator),
41 ... rev_id=rev_id, log_body=log_body)41 ... rev_id=rev_id, log_body=log_body)
42 >>> ignored = fooey_branch.createBranchRevision(42 >>> ignored = fooey_branch.createBranchRevision(
43 ... 1, makeRevision(43 ... 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):
132 for result_status in sorted(CodeImportResultStatus.items)[132 for result_status in sorted(CodeImportResultStatus.items)[
133 start:start + count]:133 start:start + count]:
134 factory.makeCodeImportResult(134 factory.makeCodeImportResult(
135 code_import, result_status, start_dates.next(), end_dates.next(),135 code_import, result_status, next(start_dates), next(end_dates),
136 machine=machine)136 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():
160 yield name160 yield name
161 index = count(1)161 index = count(1)
162 while True:162 while True:
163 yield "branch-%s" % index.next()163 yield "branch-%s" % next(index)
164164
165165
166def make_package_branches(factory, series, sourcepackagename, branch_count,166def make_package_branches(factory, series, sourcepackagename, branch_count,
@@ -180,8 +180,8 @@ def make_package_branches(factory, series, sourcepackagename, branch_count,
180 factory.makePackageBranch(180 factory.makePackageBranch(
181 distroseries=series,181 distroseries=series,
182 sourcepackagename=sourcepackagename,182 sourcepackagename=sourcepackagename,
183 date_created=time_gen.next(),183 date_created=next(time_gen),
184 name=branch_names.next(), owner=owner, registrant=registrant)184 name=next(branch_names), owner=owner, registrant=registrant)
185 for i in range(branch_count)]185 for i in range(branch_count)]
186186
187 official = []187 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):
47 """See `IVocabularyTokenized`."""47 """See `IVocabularyTokenized`."""
48 search_results = self.searchForTerms(token)48 search_results = self.searchForTerms(token)
49 if search_results.count() == 1:49 if search_results.count() == 1:
50 return iter(search_results).next()50 return next(iter(search_results))
51 raise LookupError(token)51 raise LookupError(token)
5252
53 def searchForTerms(self, query=None, vocab_filter=None):53 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):
43 """See `IVocabularyTokenized`."""43 """See `IVocabularyTokenized`."""
44 search_results = self.searchForTerms(token)44 search_results = self.searchForTerms(token)
45 if search_results.count() == 1:45 if search_results.count() == 1:
46 return iter(search_results).next()46 return next(iter(search_results))
47 raise LookupError(token)47 raise LookupError(token)
4848
49 def searchForTerms(self, query=None, vocab_filter=None):49 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):
127 iterator = iter(merge_sorted)127 iterator = iter(merge_sorted)
128 while True:128 while True:
129 try:129 try:
130 rev_id, depth, revno, ignored = iterator.next()130 rev_id, depth, revno, ignored = next(iterator)
131 except StopIteration:131 except StopIteration:
132 break132 break
133 if depth == 0:133 if depth == 0:
diff --git a/lib/lp/codehosting/sftp.py b/lib/lp/codehosting/sftp.py
index 51d42e7..3c9dfb7 100644
--- a/lib/lp/codehosting/sftp.py
+++ b/lib/lp/codehosting/sftp.py
@@ -31,6 +31,7 @@ from breezy import (
31 )31 )
32from breezy.transport.local import LocalTransport32from breezy.transport.local import LocalTransport
33from lazr.sshserver.sftp import FileIsADirectory33from lazr.sshserver.sftp import FileIsADirectory
34import six
34from twisted.conch.interfaces import (35from twisted.conch.interfaces import (
35 ISFTPFile,36 ISFTPFile,
36 ISFTPServer,37 ISFTPServer,
@@ -97,7 +98,7 @@ def with_sftp_error(func):
97 return util.mergeFunctionMetadata(func, decorator)98 return util.mergeFunctionMetadata(func, decorator)
9899
99100
100class DirectoryListing:101class DirectoryListing(six.Iterator):
101 """Class to satisfy openDirectory return interface.102 """Class to satisfy openDirectory return interface.
102103
103 openDirectory returns an iterator -- with a `close` method. Hence104 openDirectory returns an iterator -- with a `close` method. Hence
@@ -110,8 +111,8 @@ class DirectoryListing:
110 def __iter__(self):111 def __iter__(self):
111 return self112 return self
112113
113 def next(self):114 def __next__(self):
114 return self.iter.next()115 return next(self.iter)
115116
116 def close(self):117 def close(self):
117 # I can't believe we had to implement a whole class just to118 # I can't believe we had to implement a whole class just to
@@ -191,7 +192,7 @@ class TransportSFTPFile:
191 self._escaped_path, [(offset, length)])192 self._escaped_path, [(offset, length)])
192193
193 def get_first_chunk(read_things):194 def get_first_chunk(read_things):
194 return read_things.next()[1]195 return next(read_things)[1]
195196
196 def handle_short_read(failure):197 def handle_short_read(failure):
197 """Handle short reads by reading what was available.198 """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:
607 [(3, 2)])607 [(3, 2)])
608608
609 def get_chunk(generator):609 def get_chunk(generator):
610 return generator.next()[1]610 return next(generator)[1]
611 deferred.addCallback(get_chunk)611 deferred.addCallback(get_chunk)
612 return deferred.addCallback(self.assertEqual, data[3:5])612 return deferred.addCallback(self.assertEqual, data[3:5])
613613
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.
294294
295First, we will test a merge where there is no decoration.295First, we will test a merge where there is no decoration.
296296
297 >>> winner, loser = endless_supply_of_players.next()297 >>> winner, loser = next(endless_supply_of_players)
298 >>> print decorator_refs(store, winner, loser)298 >>> print decorator_refs(store, winner, loser)
299 <BLANKLINE>299 <BLANKLINE>
300300
@@ -316,7 +316,7 @@ There should still be no columns that reference the winner or loser.
316OK, now, this time, we will add some decorator information to the winner316OK, now, this time, we will add some decorator information to the winner
317but not the loser.317but not the loser.
318318
319 >>> winner, loser = endless_supply_of_players.next()319 >>> winner, loser = next(endless_supply_of_players)
320 >>> winner.setLocation(None, None, 'America/Santiago', winner)320 >>> winner.setLocation(None, None, 'America/Santiago', winner)
321 >>> print decorator_refs(store, winner, loser)321 >>> print decorator_refs(store, winner, loser)
322 winner, winner,322 winner, winner,
@@ -333,7 +333,7 @@ the winner:
333This time, we will have a decorator for the person that is being merged333This time, we will have a decorator for the person that is being merged
334INTO another person, but nothing on the target person.334INTO another person, but nothing on the target person.
335335
336 >>> winner, loser = endless_supply_of_players.next()336 >>> winner, loser = next(endless_supply_of_players)
337 >>> loser.setLocation(None, None, 'America/Santiago', loser)337 >>> loser.setLocation(None, None, 'America/Santiago', loser)
338 >>> print decorator_refs(store, winner, loser)338 >>> print decorator_refs(store, winner, loser)
339 loser, loser,339 loser, loser,
@@ -352,7 +352,7 @@ to_person and the from_person. We expect that the from_person record
352will remain as noise but non-unique columns will have been updated to352will remain as noise but non-unique columns will have been updated to
353point to the winner, and the to_person will be unaffected.353point to the winner, and the to_person will be unaffected.
354354
355 >>> winner, loser = endless_supply_of_players.next()355 >>> winner, loser = next(endless_supply_of_players)
356 >>> winner.setLocation(None, None, 'America/Santiago', winner)356 >>> winner.setLocation(None, None, 'America/Santiago', winner)
357 >>> loser.setLocation(None, None, 'America/New_York', loser)357 >>> loser.setLocation(None, None, 'America/New_York', loser)
358 >>> print decorator_refs(store, winner, loser)358 >>> 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.
41 ... Date: %s41 ... Date: %s
42 ...42 ...
43 ... Point of order!43 ... Point of order!
44 ... """ % (from_address, to_team_name, message_ids.next(), formatdate()))44 ... """ % (from_address, to_team_name, next(message_ids), formatdate()))
45 ... mailing_list = getUtility(IMailingListSet).get(to_team_name)45 ... mailing_list = getUtility(IMailingListSet).get(to_team_name)
46 ... held_message = mailing_list.holdMessage(message)46 ... held_message = mailing_list.holdMessage(message)
47 ... return held_message47 ... 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):
70 MilestoneTag.created_by_id,70 MilestoneTag.created_by_id,
71 MilestoneTag.date_created,71 MilestoneTag.date_created,
72 )72 )
73 created_by_id, date_created = values.next()73 created_by_id, date_created = next(values)
74 self.assertEqual(self.person.id, created_by_id)74 self.assertEqual(self.person.id, created_by_id)
75 self.assertIsInstance(date_created, datetime.datetime)75 self.assertIsInstance(date_created, datetime.datetime)
7676
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):
112 # logfile that has been rotated already, so it should be safe to112 # logfile that has been rotated already, so it should be safe to
113 # parse its last line.113 # parse its last line.
114 try:114 try:
115 next_line = fd.next()115 next_line = next(fd)
116 except StopIteration:116 except StopIteration:
117 if parsed_lines > 0:117 if parsed_lines > 0:
118 break118 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.
17 >>> class Foo(object):17 >>> class Foo(object):
18 ... @cachedproperty18 ... @cachedproperty
19 ... def bar(self):19 ... def bar(self):
20 ... return counter.next()20 ... return next(counter)
2121
22 >>> foo = Foo()22 >>> foo = Foo()
2323
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):
144 def test_non_ascii_filter(self):144 def test_non_ascii_filter(self):
145 """localKeys should not error if passed non-ascii unicode strings."""145 """localKeys should not error if passed non-ascii unicode strings."""
146 filtered_keys = self.gpg_handler.localKeys(u'non-ascii \u8463')146 filtered_keys = self.gpg_handler.localKeys(u'non-ascii \u8463')
147 self.assertRaises(StopIteration, filtered_keys.next)147 self.assertRaises(StopIteration, next, filtered_keys)
148148
149 def testTestkeyrings(self):149 def testTestkeyrings(self):
150 """Do we have the expected test keyring files"""150 """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:
309309
310 def _next_chunk(self):310 def _next_chunk(self):
311 try:311 try:
312 return self._chunks.next()312 return next(self._chunks)
313 except StopIteration:313 except StopIteration:
314 return None314 return None
315315
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.
25 >>> from mailbox import UnixMailbox25 >>> from mailbox import UnixMailbox
26 >>> mbox_file = open(mbox_filename)26 >>> mbox_file = open(mbox_filename)
27 >>> mbox = UnixMailbox(mbox_file)27 >>> mbox = UnixMailbox(mbox_file)
28 >>> msg = mbox.next()28 >>> msg = next(mbox)
29 >>> msg['from']29 >>> msg['from']
30 'geddy@example.com'30 'geddy@example.com'
31 >>> msg['to']31 >>> msg['to']
@@ -43,7 +43,7 @@ Read the mbox file and make sure the message we just mailed is in there.
4343
44There should be no other messages in the mbox file.44There should be no other messages in the mbox file.
4545
46 >>> mbox.next()46 >>> next(mbox)
47 >>> mbox_file.close()47 >>> mbox_file.close()
4848
49Create another mailer, again that overwrites. Make sure it actually does49Create another mailer, again that overwrites. Make sure it actually does
@@ -63,10 +63,10 @@ overwrite.
6363
64 >>> mbox_file = open(mbox_filename)64 >>> mbox_file = open(mbox_filename)
65 >>> mbox = UnixMailbox(mbox_file)65 >>> mbox = UnixMailbox(mbox_file)
66 >>> msg = mbox.next()66 >>> msg = next(mbox)
67 >>> msg['from']67 >>> msg['from']
68 'mick@example.com'68 'mick@example.com'
69 >>> mbox.next()69 >>> next(mbox)
70 >>> mbox_file.close()70 >>> mbox_file.close()
7171
72Create another mailer, this time one that does not overwrite. Both the72Create another mailer, this time one that does not overwrite. Both the
@@ -87,10 +87,10 @@ mbox file.
8787
88 >>> mbox_file = open(mbox_filename)88 >>> mbox_file = open(mbox_filename)
89 >>> mbox = UnixMailbox(mbox_file)89 >>> mbox = UnixMailbox(mbox_file)
90 >>> msg = mbox.next()90 >>> msg = next(mbox)
91 >>> msg['from']91 >>> msg['from']
92 'mick@example.com'92 'mick@example.com'
93 >>> msg = mbox.next()93 >>> msg = next(mbox)
94 >>> msg['from']94 >>> msg['from']
95 'carol@example.com'95 'carol@example.com'
96 >>> mbox_file.close()96 >>> mbox_file.close()
@@ -120,14 +120,14 @@ harness.
120120
121 >>> mbox_file = open(mbox_filename)121 >>> mbox_file = open(mbox_filename)
122 >>> mbox = UnixMailbox(mbox_file)122 >>> mbox = UnixMailbox(mbox_file)
123 >>> msg = mbox.next()123 >>> msg = next(mbox)
124 >>> msg['from']124 >>> msg['from']
125 'sting@example.com'125 'sting@example.com'
126 >>> msg = mbox.next()126 >>> msg = next(mbox)
127127
128 >>> mbox_file = open(chained_filename)128 >>> mbox_file = open(chained_filename)
129 >>> mbox = UnixMailbox(mbox_file)129 >>> mbox = UnixMailbox(mbox_file)
130 >>> msg = mbox.next()130 >>> msg = next(mbox)
131 >>> msg['from']131 >>> msg['from']
132 'sting@example.com'132 'sting@example.com'
133 >>> msg = mbox.next()133 >>> 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):
201 ci = CachingIterator(partial(iter, [0, 1, 2, 3, 4]))201 ci = CachingIterator(partial(iter, [0, 1, 2, 3, 4]))
202 i1 = iter(ci)202 i1 = iter(ci)
203 i2 = iter(ci)203 i2 = iter(ci)
204 self.assertEqual(0, i1.next())204 self.assertEqual(0, next(i1))
205 self.assertEqual(0, i2.next())205 self.assertEqual(0, next(i2))
206 self.assertEqual([1, 2, 3, 4], list(i2))206 self.assertEqual([1, 2, 3, 4], list(i2))
207 self.assertEqual([1, 2, 3, 4], list(i1))207 self.assertEqual([1, 2, 3, 4], list(i1))
208208
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 @@
44
5__metaclass__ = type5__metaclass__ = type
66
7from functools import partial
8
7from twisted.internet.defer import (9from twisted.internet.defer import (
8 Deferred,10 Deferred,
9 succeed,11 succeed,
@@ -193,7 +195,8 @@ class TestPollingTaskSource(TestCase):
193 self.factory.getUniqueString(), self.factory.getUniqueString()]195 self.factory.getUniqueString(), self.factory.getUniqueString()]
194 consumer1_tasks = []196 consumer1_tasks = []
195 consumer2_tasks = []197 consumer2_tasks = []
196 task_source = self.makeTaskSource(task_producer=iter(tasks).next)198 task_source = self.makeTaskSource(
199 task_producer=partial(next, iter(tasks)))
197 task_source.start(AppendingTaskConsumer(consumer1_tasks))200 task_source.start(AppendingTaskConsumer(consumer1_tasks))
198 task_source.start(AppendingTaskConsumer(consumer2_tasks))201 task_source.start(AppendingTaskConsumer(consumer2_tasks))
199 self.assertEqual(202 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
333to work properly.333to work properly.
334334
335 >>> iterator = canonical_url_iterator(object_that_has_no_url)335 >>> iterator = canonical_url_iterator(object_that_has_no_url)
336 >>> iterator.next().__class__.__name__336 >>> next(iterator).__class__.__name__
337 'object'337 'object'
338 >>> iterator.next()338 >>> next(iterator)
339 Traceback (most recent call last):339 Traceback (most recent call last):
340 ...340 ...
341 NoCanonicalUrl: No url for <...object...> because <...object...> broke the chain.341 NoCanonicalUrl: No url for <...object...> because <...object...> broke the chain.
342342
343 >>> iterator = canonical_url_iterator(unrooted_object)343 >>> iterator = canonical_url_iterator(unrooted_object)
344 >>> iterator.next().__class__.__name__344 >>> next(iterator).__class__.__name__
345 'ObjectThatHasUrl'345 'ObjectThatHasUrl'
346 >>> iterator.next().__class__.__name__346 >>> next(iterator).__class__.__name__
347 'object'347 'object'
348 >>> iterator.next()348 >>> next(iterator)
349 Traceback (most recent call last):349 Traceback (most recent call last):
350 ...350 ...
351 NoCanonicalUrl: No url for <...ObjectThatHasUrl...> because <...object...> broke the chain.351 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:
449 :param message: Unicode message.449 :param message: Unicode message.
450 :returns: Key for this message.450 :returns: Key for this message.
451 """451 """
452 key = self._oops_message_key_iter.next()452 key = next(self._oops_message_key_iter)
453 self._oops_messages[key] = message453 self._oops_messages[key] = message
454 return key454 return key
455455
diff --git a/lib/lp/services/webapp/servers.py b/lib/lp/services/webapp/servers.py
index 33cf173..8b85df8 100644
--- a/lib/lp/services/webapp/servers.py
+++ b/lib/lp/services/webapp/servers.py
@@ -113,7 +113,7 @@ from lp.testopenid.interfaces.server import ITestOpenIDApplication
113from lp.xmlrpc.interfaces import IPrivateApplication113from lp.xmlrpc.interfaces import IPrivateApplication
114114
115115
116class StepsToGo:116class StepsToGo(six.Iterator):
117 """117 """
118118
119 >>> class FakeRequest:119 >>> class FakeRequest:
@@ -195,7 +195,7 @@ class StepsToGo:
195 except IndexError:195 except IndexError:
196 return None196 return None
197197
198 def next(self):198 def __next__(self):
199 value = self.consume()199 value = self.consume()
200 if value is None:200 if value is None:
201 raise StopIteration201 raise StopIteration
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):
489489
490 def __init__(self):490 def __init__(self):
491 super(LoneObject, self).__init__(self)491 super(LoneObject, self).__init__(self)
492 self.id = LoneObject._id_counter.next()492 self.id = next(LoneObject._id_counter)
493493
494 def getParentContainers(self):494 def getParentContainers(self):
495 return []495 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)):
1320 by the delta.1320 by the delta.
13211321
1322 >>> now = time_counter(datetime(2007, 12, 1), timedelta(days=1))1322 >>> now = time_counter(datetime(2007, 12, 1), timedelta(days=1))
1323 >>> now.next()1323 >>> next(now)
1324 datetime.datetime(2007, 12, 1, 0, 0)1324 datetime.datetime(2007, 12, 1, 0, 0)
1325 >>> now.next()1325 >>> next(now)
1326 datetime.datetime(2007, 12, 2, 0, 0)1326 datetime.datetime(2007, 12, 2, 0, 0)
1327 >>> now.next()1327 >>> next(now)
1328 datetime.datetime(2007, 12, 3, 0, 0)1328 datetime.datetime(2007, 12, 3, 0, 0)
1329 """1329 """
1330 if origin is None:1330 if origin is None:
diff --git a/lib/lp/testing/factory.py b/lib/lp/testing/factory.py
index 6c0492f..61efb37 100644
--- a/lib/lp/testing/factory.py
+++ b/lib/lp/testing/factory.py
@@ -440,7 +440,7 @@ class ObjectFactory:
440 For each thread, this will be a series of increasing numbers, but the440 For each thread, this will be a series of increasing numbers, but the
441 starting point will be unique per thread.441 starting point will be unique per thread.
442 """442 """
443 return ObjectFactory._unique_int_counter.next()443 return next(ObjectFactory._unique_int_counter)
444444
445 def getUniqueHexString(self, digits=None):445 def getUniqueHexString(self, digits=None):
446 """Return a unique hexadecimal string.446 """Return a unique hexadecimal string.
@@ -1740,7 +1740,7 @@ class BareLaunchpadObjectFactory(ObjectFactory):
1740 revision = revision_set.new(1740 revision = revision_set.new(
1741 revision_id=self.getUniqueString('revision-id'),1741 revision_id=self.getUniqueString('revision-id'),
1742 log_body=self.getUniqueString('log-body'),1742 log_body=self.getUniqueString('log-body'),
1743 revision_date=date_generator.next(),1743 revision_date=next(date_generator),
1744 revision_author=author,1744 revision_author=author,
1745 parent_ids=parent_ids,1745 parent_ids=parent_ids,
1746 properties={})1746 properties={})
@@ -2545,7 +2545,7 @@ class BareLaunchpadObjectFactory(ObjectFactory):
2545 # If a date_started is specified, then base the finish time2545 # If a date_started is specified, then base the finish time
2546 # on that.2546 # on that.
2547 if date_started is None:2547 if date_started is None:
2548 date_finished = time_counter().next()2548 date_finished = next(time_counter())
2549 else:2549 else:
2550 date_finished = date_started + timedelta(hours=4)2550 date_finished = date_started + timedelta(hours=4)
2551 if date_started is None:2551 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 (
9 datetime,9 datetime,
10 timedelta,10 timedelta,
11 )11 )
12from functools import partial
1213
13import pytz14import pytz
14from zope.component import getUtility15from zope.component import getUtility
@@ -58,7 +59,7 @@ class TestCurrentTranslationMessage_can_dismiss(TestCaseWithFactory):
58 self.pofile = self.factory.makePOFile(potemplate=self.potemplate)59 self.pofile = self.factory.makePOFile(potemplate=self.potemplate)
59 self.potmsgset = self.factory.makePOTMsgSet(self.potemplate)60 self.potmsgset = self.factory.makePOTMsgSet(self.potemplate)
60 self.view = None61 self.view = None
61 self.now = self._gen_now().next62 self.now = partial(next, self._gen_now())
6263
63 def _createView(self, message):64 def _createView(self, message):
64 self.view = CurrentTranslationMessageView(65 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 (
7 datetime,7 datetime,
8 timedelta,8 timedelta,
9 )9 )
10from functools import partial
1011
11import pytz12import pytz
12import transaction13import transaction
@@ -648,7 +649,7 @@ class TestPOTMsgSetSuggestions(TestCaseWithFactory):
648 # Create a product with all the boilerplate objects to be able to649 # Create a product with all the boilerplate objects to be able to
649 # create TranslationMessage objects.650 # create TranslationMessage objects.
650 super(TestPOTMsgSetSuggestions, self).setUp('carlos@canonical.com')651 super(TestPOTMsgSetSuggestions, self).setUp('carlos@canonical.com')
651 self.now = self.gen_now().next652 self.now = partial(next, self.gen_now())
652 self.foo = self.factory.makeProduct(653 self.foo = self.factory.makeProduct(
653 translations_usage=ServiceUsage.LAUNCHPAD)654 translations_usage=ServiceUsage.LAUNCHPAD)
654 self.foo_main = self.factory.makeProductSeries(655 self.foo_main = self.factory.makeProductSeries(
@@ -846,7 +847,7 @@ class TestPOTMsgSetResetTranslation(TestCaseWithFactory):
846 # create TranslationMessage objects.847 # create TranslationMessage objects.
847 super(TestPOTMsgSetResetTranslation, self).setUp(848 super(TestPOTMsgSetResetTranslation, self).setUp(
848 'carlos@canonical.com')849 'carlos@canonical.com')
849 self.now = self.gen_now().next850 self.now = partial(next, self.gen_now())
850 self.foo = self.factory.makeProduct(851 self.foo = self.factory.makeProduct(
851 translations_usage=ServiceUsage.LAUNCHPAD)852 translations_usage=ServiceUsage.LAUNCHPAD)
852 self.foo_main = self.factory.makeProductSeries(853 self.foo_main = self.factory.makeProductSeries(

Subscribers

People subscribed via source and target branches

to status/vote changes: