Merge ~cjwatson/launchpad:next-builtin into launchpad:master
- Git
- lp:~cjwatson/launchpad
- next-builtin
- Merge into 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) |
Related bugs: |
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()
Description of the change
To post a comment you must log in.
Revision history for this message
Thiago F. Pappacena (pappacena) : | # |
~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
1 | diff --git a/lib/lp/answers/doc/karma.txt b/lib/lp/answers/doc/karma.txt | |||
2 | index 2a978d5..6d45d07 100644 | |||
3 | --- a/lib/lp/answers/doc/karma.txt | |||
4 | +++ b/lib/lp/answers/doc/karma.txt | |||
5 | @@ -64,7 +64,7 @@ Creating a question | |||
6 | 64 | >>> firefox = getUtility(IProductSet)['firefox'] | 64 | >>> firefox = getUtility(IProductSet)['firefox'] |
7 | 65 | >>> firefox_question = firefox.newQuestion( | 65 | >>> firefox_question = firefox.newQuestion( |
8 | 66 | ... title='New question', description='Question description.', | 66 | ... title='New question', description='Question description.', |
10 | 67 | ... owner=sample_person, datecreated=now.next()) | 67 | ... owner=sample_person, datecreated=next(now)) |
11 | 68 | Karma added: action=questionasked, product=firefox, person=name12 | 68 | Karma added: action=questionasked, product=firefox, person=name12 |
12 | 69 | 69 | ||
13 | 70 | 70 | ||
14 | @@ -77,7 +77,7 @@ will usually be called by an automated script. | |||
15 | 77 | >>> msg = firefox_question.expireQuestion( | 77 | >>> msg = firefox_question.expireQuestion( |
16 | 78 | ... foo_bar, 'Expiring because of inactivity. Reopen if you are ' | 78 | ... foo_bar, 'Expiring because of inactivity. Reopen if you are ' |
17 | 79 | ... 'still having the problem and provide additional information.', | 79 | ... 'still having the problem and provide additional information.', |
19 | 80 | ... datecreated=now.next()) | 80 | ... datecreated=next(now)) |
20 | 81 | 81 | ||
21 | 82 | 82 | ||
22 | 83 | Reopening a question | 83 | Reopening a question |
23 | @@ -85,7 +85,7 @@ Reopening a question | |||
24 | 85 | 85 | ||
25 | 86 | >>> msg = firefox_question.reopen( | 86 | >>> msg = firefox_question.reopen( |
26 | 87 | ... "Firefox doesn't have any 'Quick Searches' in its bookmarks.", | 87 | ... "Firefox doesn't have any 'Quick Searches' in its bookmarks.", |
28 | 88 | ... datecreated=now.next()) | 88 | ... datecreated=next(now)) |
29 | 89 | Karma added: action=questionreopened, product=firefox, person=name12 | 89 | Karma added: action=questionreopened, product=firefox, person=name12 |
30 | 90 | 90 | ||
31 | 91 | 91 | ||
32 | @@ -94,7 +94,7 @@ Requesting for more information | |||
33 | 94 | 94 | ||
34 | 95 | >>> msg = firefox_question.requestInfo( | 95 | >>> msg = firefox_question.requestInfo( |
35 | 96 | ... foo_bar, 'What "Quick Searches" do you want?', | 96 | ... foo_bar, 'What "Quick Searches" do you want?', |
37 | 97 | ... datecreated=now.next()) | 97 | ... datecreated=next(now)) |
38 | 98 | Karma added: action=questionrequestedinfo, product=firefox, person=name16 | 98 | Karma added: action=questionrequestedinfo, product=firefox, person=name16 |
39 | 99 | 99 | ||
40 | 100 | 100 | ||
41 | @@ -103,7 +103,7 @@ Giving back more information | |||
42 | 103 | 103 | ||
43 | 104 | >>> msg = firefox_question.giveInfo( | 104 | >>> msg = firefox_question.giveInfo( |
44 | 105 | ... 'The same one than shipped upstreams.', | 105 | ... 'The same one than shipped upstreams.', |
46 | 106 | ... datecreated=now.next()) | 106 | ... datecreated=next(now)) |
47 | 107 | Karma added: action=questiongaveinfo, product=firefox, person=name12 | 107 | Karma added: action=questiongaveinfo, product=firefox, person=name12 |
48 | 108 | 108 | ||
49 | 109 | 109 | ||
50 | @@ -112,7 +112,7 @@ Giving an answer to a question | |||
51 | 112 | 112 | ||
52 | 113 | >>> msg = firefox_question.giveAnswer( | 113 | >>> msg = firefox_question.giveAnswer( |
53 | 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 " |
55 | 115 | ... "manually for now.", datecreated=now.next()) | 115 | ... "manually for now.", datecreated=next(now)) |
56 | 116 | Karma added: action=questiongaveanswer, product=firefox, person=name16 | 116 | Karma added: action=questiongaveanswer, product=firefox, person=name16 |
57 | 117 | 117 | ||
58 | 118 | 118 | ||
59 | @@ -121,7 +121,7 @@ Adding a comment | |||
60 | 121 | 121 | ||
61 | 122 | >>> msg = firefox_question.addComment( | 122 | >>> msg = firefox_question.addComment( |
62 | 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.', |
64 | 124 | ... datecreated=now.next()) | 124 | ... datecreated=next(now)) |
65 | 125 | Karma added: action=questioncommentadded, product=firefox, person=name16 | 125 | Karma added: action=questioncommentadded, product=firefox, person=name16 |
66 | 126 | 126 | ||
67 | 127 | 127 | ||
68 | @@ -134,7 +134,7 @@ receives karma. | |||
69 | 134 | 134 | ||
70 | 135 | >>> msg = firefox_question.confirmAnswer( | 135 | >>> msg = firefox_question.confirmAnswer( |
71 | 136 | ... "Ok, thanks. I'll open a bug about this then.", | 136 | ... "Ok, thanks. I'll open a bug about this then.", |
73 | 137 | ... answer=msg, datecreated=now.next()) | 137 | ... answer=msg, datecreated=next(now)) |
74 | 138 | Karma added: action=questionansweraccepted, product=firefox, person=name12 | 138 | Karma added: action=questionansweraccepted, product=firefox, person=name12 |
75 | 139 | Karma added: action=questionanswered, product=firefox, person=name16 | 139 | Karma added: action=questionanswered, product=firefox, person=name16 |
76 | 140 | 140 | ||
77 | @@ -156,7 +156,7 @@ We do not grant karma for status change made outside of workflow: | |||
78 | 156 | >>> from lp.answers.enums import QuestionStatus | 156 | >>> from lp.answers.enums import QuestionStatus |
79 | 157 | >>> msg = firefox_question.setStatus( | 157 | >>> msg = firefox_question.setStatus( |
80 | 158 | ... foo_bar, QuestionStatus.OPEN, 'That rejection was an error.', | 158 | ... foo_bar, QuestionStatus.OPEN, 'That rejection was an error.', |
82 | 159 | ... datecreated=now.next()) | 159 | ... datecreated=next(now)) |
83 | 160 | 160 | ||
84 | 161 | 161 | ||
85 | 162 | Changing the title of a question | 162 | Changing the title of a question |
86 | @@ -205,7 +205,7 @@ persons who were awarded it in the past. | |||
87 | 205 | >>> msg = firefox_question.giveAnswer( | 205 | >>> msg = firefox_question.giveAnswer( |
88 | 206 | ... sample_person, "I was able to import some by following the " | 206 | ... sample_person, "I was able to import some by following the " |
89 | 207 | ... "instructions on http://tinyurl.com/cyus4", | 207 | ... "instructions on http://tinyurl.com/cyus4", |
91 | 208 | ... datecreated=now.next()) | 208 | ... datecreated=next(now)) |
92 | 209 | 209 | ||
93 | 210 | 210 | ||
94 | 211 | Creating a FAQ | 211 | Creating a FAQ |
95 | diff --git a/lib/lp/answers/tests/emailinterface.txt b/lib/lp/answers/tests/emailinterface.txt | |||
96 | index 8718ea1..f30e23e 100644 | |||
97 | --- a/lib/lp/answers/tests/emailinterface.txt | |||
98 | +++ b/lib/lp/answers/tests/emailinterface.txt | |||
99 | @@ -38,7 +38,7 @@ AnswerTrackerHandler. | |||
100 | 38 | ... lines = ['From: %s' % from_addr] | 38 | ... lines = ['From: %s' % from_addr] |
101 | 39 | ... to_addr = 'question%s@answers.launchpad.net' % question_id | 39 | ... to_addr = 'question%s@answers.launchpad.net' % question_id |
102 | 40 | ... lines.append('To: %s' % to_addr) | 40 | ... lines.append('To: %s' % to_addr) |
104 | 41 | ... date = mktime_tz(now.next().utctimetuple() + (0, )) | 41 | ... date = mktime_tz(next(now).utctimetuple() + (0, )) |
105 | 42 | ... lines.append('Date: %s' % formatdate(date)) | 42 | ... lines.append('Date: %s' % formatdate(date)) |
106 | 43 | ... msgid = make_msgid() | 43 | ... msgid = make_msgid() |
107 | 44 | ... lines.append('Message-Id: %s' % msgid) | 44 | ... lines.append('Message-Id: %s' % msgid) |
108 | @@ -116,7 +116,7 @@ possibilities for the user. | |||
109 | 116 | ... question = ubuntu.newQuestion( | 116 | ... question = ubuntu.newQuestion( |
110 | 117 | ... no_priv, 'Unable to boot installer', | 117 | ... no_priv, 'Unable to boot installer', |
111 | 118 | ... "I've tried installing Ubuntu on a Mac. But the installer " | 118 | ... "I've tried installing Ubuntu on a Mac. But the installer " |
113 | 119 | ... "never boots.", datecreated=now.next()) | 119 | ... "never boots.", datecreated=next(now)) |
114 | 120 | ... question_id = question.id | 120 | ... question_id = question.id |
115 | 121 | 121 | ||
116 | 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. |
117 | @@ -127,7 +127,7 @@ possibilities for the user. | |||
118 | 127 | >>> def setQuestionStatus(question, new_status): | 127 | >>> def setQuestionStatus(question, new_status): |
119 | 128 | ... login('foo.bar@canonical.com') | 128 | ... login('foo.bar@canonical.com') |
120 | 129 | ... question.setStatus(foo_bar, new_status, 'Status Change', | 129 | ... question.setStatus(foo_bar, new_status, 'Status Change', |
122 | 130 | ... datecreated=now.next()) | 130 | ... datecreated=next(now)) |
123 | 131 | ... login('no-priv@canonical.com') | 131 | ... login('no-priv@canonical.com') |
124 | 132 | 132 | ||
125 | 133 | Message From the Question Owner | 133 | Message From the Question Owner |
126 | diff --git a/lib/lp/app/browser/launchpad.py b/lib/lp/app/browser/launchpad.py | |||
127 | index d12c849..4aa9a39 100644 | |||
128 | --- a/lib/lp/app/browser/launchpad.py | |||
129 | +++ b/lib/lp/app/browser/launchpad.py | |||
130 | @@ -271,9 +271,9 @@ class Hierarchy(LaunchpadView): | |||
131 | 271 | """The objects for which we want breadcrumbs.""" | 271 | """The objects for which we want breadcrumbs.""" |
132 | 272 | # Start the chain with the deepest object that has a breadcrumb. | 272 | # Start the chain with the deepest object that has a breadcrumb. |
133 | 273 | try: | 273 | try: |
135 | 274 | objects = [( | 274 | objects = [next(( |
136 | 275 | obj for obj in reversed(self.request.traversed_objects) | 275 | obj for obj in reversed(self.request.traversed_objects) |
138 | 276 | if IBreadcrumb(obj, None)).next()] | 276 | if IBreadcrumb(obj, None)))] |
139 | 277 | except StopIteration: | 277 | except StopIteration: |
140 | 278 | return [] | 278 | return [] |
141 | 279 | # Now iterate. If an object has a breadcrumb, it can override | 279 | # Now iterate. If an object has a breadcrumb, it can override |
142 | diff --git a/lib/lp/bugs/browser/tests/test_cve.py b/lib/lp/bugs/browser/tests/test_cve.py | |||
143 | index e0b485e..ee760e3 100644 | |||
144 | --- a/lib/lp/bugs/browser/tests/test_cve.py | |||
145 | +++ b/lib/lp/bugs/browser/tests/test_cve.py | |||
146 | @@ -3,6 +3,7 @@ | |||
147 | 3 | 3 | ||
148 | 4 | """CVE related tests.""" | 4 | """CVE related tests.""" |
149 | 5 | 5 | ||
150 | 6 | from functools import partial | ||
151 | 6 | from operator import attrgetter | 7 | from operator import attrgetter |
152 | 7 | import re | 8 | import re |
153 | 8 | 9 | ||
154 | @@ -35,7 +36,7 @@ class TestCVEReportView(TestCaseWithFactory): | |||
155 | 35 | self.resolved_bugtasks = [] | 36 | self.resolved_bugtasks = [] |
156 | 36 | self.unresolved_bugtasks = [] | 37 | self.unresolved_bugtasks = [] |
157 | 37 | self.cves = {} | 38 | self.cves = {} |
159 | 38 | self.getCVE = self.cveGenerator().next | 39 | self.getCVE = partial(next, self.cveGenerator()) |
160 | 39 | with person_logged_in(distroseries.owner): | 40 | with person_logged_in(distroseries.owner): |
161 | 40 | for status in RESOLVED_BUGTASK_STATUSES: | 41 | for status in RESOLVED_BUGTASK_STATUSES: |
162 | 41 | tasks, cves = self.makeBugTasksWithCve(status, distroseries) | 42 | tasks, cves = self.makeBugTasksWithCve(status, distroseries) |
163 | diff --git a/lib/lp/bugs/browser/widgets/bugtask.py b/lib/lp/bugs/browser/widgets/bugtask.py | |||
164 | index b17d19f..2f086b2 100644 | |||
165 | --- a/lib/lp/bugs/browser/widgets/bugtask.py | |||
166 | +++ b/lib/lp/bugs/browser/widgets/bugtask.py | |||
167 | @@ -384,7 +384,7 @@ class BugTaskBugWatchWidget(RadioWidget): | |||
168 | 384 | and len(self.vocabulary) > 0 | 384 | and len(self.vocabulary) > 0 |
169 | 385 | and self.context.required): | 385 | and self.context.required): |
170 | 386 | # Grab the first item from the iterator: | 386 | # Grab the first item from the iterator: |
172 | 387 | values = [iter(self.vocabulary).next().value] | 387 | values = [next(iter(self.vocabulary)).value] |
173 | 388 | elif value != self.context.missing_value: | 388 | elif value != self.context.missing_value: |
174 | 389 | values = [value] | 389 | values = [value] |
175 | 390 | else: | 390 | else: |
176 | diff --git a/lib/lp/bugs/doc/bugcomment.txt b/lib/lp/bugs/doc/bugcomment.txt | |||
177 | index f98907b..a6e9c1c 100644 | |||
178 | --- a/lib/lp/bugs/doc/bugcomment.txt | |||
179 | +++ b/lib/lp/bugs/doc/bugcomment.txt | |||
180 | @@ -270,7 +270,7 @@ We'll create an example bug with 9 comments. | |||
181 | 270 | >>> def add_comments(bug, how_many): | 270 | >>> def add_comments(bug, how_many): |
182 | 271 | ... bug_message_set = getUtility(IBugMessageSet) | 271 | ... bug_message_set = getUtility(IBugMessageSet) |
183 | 272 | ... for i in range(how_many): | 272 | ... for i in range(how_many): |
185 | 273 | ... num = comment_counter.next() | 273 | ... num = next(comment_counter) |
186 | 274 | ... bug_message_set.createMessage( | 274 | ... bug_message_set.createMessage( |
187 | 275 | ... "Comment %d" % num, bug, bug.owner, | 275 | ... "Comment %d" % num, bug, bug.owner, |
188 | 276 | ... "Something or other #%d" % num) | 276 | ... "Something or other #%d" % num) |
189 | diff --git a/lib/lp/bugs/externalbugtracker/mantis.py b/lib/lp/bugs/externalbugtracker/mantis.py | |||
190 | index 9cb8203..6021f37 100644 | |||
191 | --- a/lib/lp/bugs/externalbugtracker/mantis.py | |||
192 | +++ b/lib/lp/bugs/externalbugtracker/mantis.py | |||
193 | @@ -140,7 +140,7 @@ class MantisBugBatchParser: | |||
194 | 140 | # it because different Mantis instances have different header | 140 | # it because different Mantis instances have different header |
195 | 141 | # ordering and even different columns in the export. | 141 | # ordering and even different columns in the export. |
196 | 142 | try: | 142 | try: |
198 | 143 | headers = [h.lower() for h in reader.next()] | 143 | headers = [h.lower() for h in next(reader)] |
199 | 144 | except StopIteration: | 144 | except StopIteration: |
200 | 145 | raise UnparsableBugData("Missing header line") | 145 | raise UnparsableBugData("Missing header line") |
201 | 146 | missing_headers = [ | 146 | missing_headers = [ |
202 | diff --git a/lib/lp/bugs/externalbugtracker/roundup.py b/lib/lp/bugs/externalbugtracker/roundup.py | |||
203 | index f862aec..66f46ca 100644 | |||
204 | --- a/lib/lp/bugs/externalbugtracker/roundup.py | |||
205 | +++ b/lib/lp/bugs/externalbugtracker/roundup.py | |||
206 | @@ -219,7 +219,7 @@ class Roundup(ExternalBugTracker): | |||
207 | 219 | bug_id = int(bug_id) | 219 | bug_id = int(bug_id) |
208 | 220 | query_url = self.getSingleBugExportURL(bug_id) | 220 | query_url = self.getSingleBugExportURL(bug_id) |
209 | 221 | reader = csv.DictReader(self._getPage(query_url).iter_lines()) | 221 | reader = csv.DictReader(self._getPage(query_url).iter_lines()) |
211 | 222 | return (bug_id, reader.next()) | 222 | return (bug_id, next(reader)) |
212 | 223 | 223 | ||
213 | 224 | def getRemoteBugBatch(self, bug_ids): | 224 | def getRemoteBugBatch(self, bug_ids): |
214 | 225 | """See `ExternalBugTracker`""" | 225 | """See `ExternalBugTracker`""" |
215 | diff --git a/lib/lp/bugs/externalbugtracker/trac.py b/lib/lp/bugs/externalbugtracker/trac.py | |||
216 | index d10d8f2..ab36b7e 100644 | |||
217 | --- a/lib/lp/bugs/externalbugtracker/trac.py | |||
218 | +++ b/lib/lp/bugs/externalbugtracker/trac.py | |||
219 | @@ -151,7 +151,7 @@ class Trac(ExternalBugTracker): | |||
220 | 151 | # We read the remote bugs into a list so that we can check that | 151 | # We read the remote bugs into a list so that we can check that |
221 | 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. |
222 | 153 | csv_reader = csv.DictReader(self._getPage(query_url).iter_lines()) | 153 | csv_reader = csv.DictReader(self._getPage(query_url).iter_lines()) |
224 | 154 | remote_bugs = [csv_reader.next()] | 154 | remote_bugs = [next(csv_reader)] |
225 | 155 | 155 | ||
226 | 156 | # We consider the data we're getting from the remote server to | 156 | # We consider the data we're getting from the remote server to |
227 | 157 | # be valid if there is an ID field and a status field in the CSV | 157 | # be valid if there is an ID field and a status field in the CSV |
228 | diff --git a/lib/lp/bugs/scripts/debbugs.py b/lib/lp/bugs/scripts/debbugs.py | |||
229 | index c632743..90de42f 100644 | |||
230 | --- a/lib/lp/bugs/scripts/debbugs.py | |||
231 | +++ b/lib/lp/bugs/scripts/debbugs.py | |||
232 | @@ -8,6 +8,8 @@ import os | |||
233 | 8 | import re | 8 | import re |
234 | 9 | import subprocess | 9 | import subprocess |
235 | 10 | 10 | ||
236 | 11 | import six | ||
237 | 12 | |||
238 | 11 | 13 | ||
239 | 12 | class Bug: | 14 | class Bug: |
240 | 13 | def __init__(self, db, id, package=None, date=None, status=None, | 15 | def __init__(self, db, id, package=None, date=None, status=None, |
241 | @@ -97,7 +99,7 @@ class Database: | |||
242 | 97 | self.debbugs_pl = debbugs_pl | 99 | self.debbugs_pl = debbugs_pl |
243 | 98 | self.subdir = subdir | 100 | self.subdir = subdir |
244 | 99 | 101 | ||
246 | 100 | class bug_iterator: | 102 | class bug_iterator(six.Iterator): |
247 | 101 | index_record = re.compile( | 103 | index_record = re.compile( |
248 | 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+) ' |
249 | 103 | r'\[(?P<originator>.*)\] (?P<severity>\w+)(?: (?P<tags>.*))?$') | 105 | r'\[(?P<originator>.*)\] (?P<severity>\w+)(?: (?P<tags>.*))?$') |
250 | @@ -107,7 +109,7 @@ class Database: | |||
251 | 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')) |
252 | 108 | self.filter = filter | 110 | self.filter = filter |
253 | 109 | 111 | ||
255 | 110 | def next(self): | 112 | def __next__(self): |
256 | 111 | line = self.index.readline() | 113 | line = self.index.readline() |
257 | 112 | if not line: | 114 | if not line: |
258 | 113 | raise StopIteration | 115 | raise StopIteration |
259 | diff --git a/lib/lp/bugs/scripts/tests/test_bugnotification.py b/lib/lp/bugs/scripts/tests/test_bugnotification.py | |||
260 | index 1b3f4cb..734b68f 100644 | |||
261 | --- a/lib/lp/bugs/scripts/tests/test_bugnotification.py | |||
262 | +++ b/lib/lp/bugs/scripts/tests/test_bugnotification.py | |||
263 | @@ -427,7 +427,7 @@ class TestGetEmailNotifications(TestCase): | |||
264 | 427 | # Now we create the generator, start it, and then close it, triggering | 427 | # Now we create the generator, start it, and then close it, triggering |
265 | 428 | # a GeneratorExit exception inside the generator. | 428 | # a GeneratorExit exception inside the generator. |
266 | 429 | email_notifications = get_email_notifications(notifications) | 429 | email_notifications = get_email_notifications(notifications) |
268 | 430 | email_notifications.next() | 430 | next(email_notifications) |
269 | 431 | email_notifications.close() | 431 | email_notifications.close() |
270 | 432 | 432 | ||
271 | 433 | # Verify that no "Error while building email notifications." is logged. | 433 | # Verify that no "Error while building email notifications." is logged. |
272 | @@ -706,7 +706,7 @@ class EmailNotificationsBugMixin: | |||
273 | 706 | def test_change_seen(self): | 706 | def test_change_seen(self): |
274 | 707 | # A smoketest. | 707 | # A smoketest. |
275 | 708 | self.change(self.old, self.new) | 708 | self.change(self.old, self.new) |
277 | 709 | message, body = self.get_messages().next() | 709 | message, body = next(self.get_messages()) |
278 | 710 | self.assertThat(body, Contains(self.unexpected_text)) | 710 | self.assertThat(body, Contains(self.unexpected_text)) |
279 | 711 | 711 | ||
280 | 712 | def test_undone_change_sends_no_emails(self): | 712 | def test_undone_change_sends_no_emails(self): |
281 | @@ -718,7 +718,7 @@ class EmailNotificationsBugMixin: | |||
282 | 718 | self.change(self.old, self.new) | 718 | self.change(self.old, self.new) |
283 | 719 | self.change(self.new, self.old) | 719 | self.change(self.new, self.old) |
284 | 720 | self.change_other() | 720 | self.change_other() |
286 | 721 | message, body = self.get_messages().next() | 721 | message, body = next(self.get_messages()) |
287 | 722 | self.assertThat(body, Not(Contains(self.unexpected_text))) | 722 | self.assertThat(body, Not(Contains(self.unexpected_text))) |
288 | 723 | 723 | ||
289 | 724 | def test_multiple_undone_changes_sends_no_emails(self): | 724 | def test_multiple_undone_changes_sends_no_emails(self): |
290 | @@ -761,7 +761,7 @@ class EmailNotificationsBugTaskMixin(EmailNotificationsBugMixin): | |||
291 | 761 | self.bug.addTask(self.product_owner, product2) | 761 | self.bug.addTask(self.product_owner, product2) |
292 | 762 | self.change(self.old, self.new, index=0) | 762 | self.change(self.old, self.new, index=0) |
293 | 763 | self.change(self.new, self.old, index=1) | 763 | self.change(self.new, self.old, index=1) |
295 | 764 | message, body = self.get_messages().next() | 764 | message, body = next(self.get_messages()) |
296 | 765 | self.assertThat(body, Contains(self.unexpected_text)) | 765 | self.assertThat(body, Contains(self.unexpected_text)) |
297 | 766 | 766 | ||
298 | 767 | 767 | ||
299 | @@ -775,7 +775,7 @@ class EmailNotificationsAddedRemovedMixin: | |||
300 | 775 | 775 | ||
301 | 776 | def test_added_seen(self): | 776 | def test_added_seen(self): |
302 | 777 | self.add(self.old) | 777 | self.add(self.old) |
304 | 778 | message, body = self.get_messages().next() | 778 | message, body = next(self.get_messages()) |
305 | 779 | self.assertThat(body, Contains(self.added_message)) | 779 | self.assertThat(body, Contains(self.added_message)) |
306 | 780 | 780 | ||
307 | 781 | def test_added_removed_sends_no_emails(self): | 781 | def test_added_removed_sends_no_emails(self): |
308 | @@ -791,7 +791,7 @@ class EmailNotificationsAddedRemovedMixin: | |||
309 | 791 | def test_added_another_removed_sends_emails(self): | 791 | def test_added_another_removed_sends_emails(self): |
310 | 792 | self.add(self.old) | 792 | self.add(self.old) |
311 | 793 | self.remove(self.new) | 793 | self.remove(self.new) |
313 | 794 | message, body = self.get_messages().next() | 794 | message, body = next(self.get_messages()) |
314 | 795 | self.assertThat(body, Contains(self.added_message)) | 795 | self.assertThat(body, Contains(self.added_message)) |
315 | 796 | self.assertThat(body, Contains(self.removed_message)) | 796 | self.assertThat(body, Contains(self.removed_message)) |
316 | 797 | 797 | ||
317 | diff --git a/lib/lp/code/browser/sourcepackagerecipe.py b/lib/lp/code/browser/sourcepackagerecipe.py | |||
318 | index 482d892..5ae3eee 100644 | |||
319 | --- a/lib/lp/code/browser/sourcepackagerecipe.py | |||
320 | +++ b/lib/lp/code/browser/sourcepackagerecipe.py | |||
321 | @@ -755,7 +755,7 @@ class SourcePackageRecipeAddView(RecipeRelatedBranchesMixin, | |||
322 | 755 | yield "%s-daily" % branch_target_name | 755 | yield "%s-daily" % branch_target_name |
323 | 756 | counter = itertools.count(1) | 756 | counter = itertools.count(1) |
324 | 757 | while True: | 757 | while True: |
326 | 758 | yield "%s-daily-%s" % (branch_target_name, counter.next()) | 758 | yield "%s-daily-%s" % (branch_target_name, next(counter)) |
327 | 759 | 759 | ||
328 | 760 | def _find_unused_name(self, owner): | 760 | def _find_unused_name(self, owner): |
329 | 761 | # Grab the last path element of the branch target path. | 761 | # Grab the last path element of the branch target path. |
330 | diff --git a/lib/lp/code/browser/tests/test_branchlisting.py b/lib/lp/code/browser/tests/test_branchlisting.py | |||
331 | index 8598090..5aed624 100644 | |||
332 | --- a/lib/lp/code/browser/tests/test_branchlisting.py | |||
333 | +++ b/lib/lp/code/browser/tests/test_branchlisting.py | |||
334 | @@ -123,7 +123,7 @@ class TestPersonOwnedBranchesView(TestCaseWithFactory, | |||
335 | 123 | self.branches = [ | 123 | self.branches = [ |
336 | 124 | self.factory.makeProductBranch( | 124 | self.factory.makeProductBranch( |
337 | 125 | product=self.bambam, owner=self.barney, | 125 | product=self.bambam, owner=self.barney, |
339 | 126 | date_created=time_gen.next()) | 126 | date_created=next(time_gen)) |
340 | 127 | for i in range(10)] | 127 | for i in range(10)] |
341 | 128 | self.bug = self.factory.makeBug() | 128 | self.bug = self.factory.makeBug() |
342 | 129 | self.bug.linkBranch(self.branches[0], self.barney) | 129 | self.bug.linkBranch(self.branches[0], self.barney) |
343 | @@ -459,7 +459,7 @@ class TestGroupedDistributionSourcePackageBranchesView(TestCaseWithFactory): | |||
344 | 459 | self.factory.makePackageBranch( | 459 | self.factory.makePackageBranch( |
345 | 460 | distroseries=distroseries, | 460 | distroseries=distroseries, |
346 | 461 | sourcepackagename=self.sourcepackagename, | 461 | sourcepackagename=self.sourcepackagename, |
348 | 462 | date_created=time_gen.next()) | 462 | date_created=next(time_gen)) |
349 | 463 | for i in range(branch_count)] | 463 | for i in range(branch_count)] |
350 | 464 | 464 | ||
351 | 465 | official = [] | 465 | official = [] |
352 | diff --git a/lib/lp/code/browser/tests/test_branchmergeproposal.py b/lib/lp/code/browser/tests/test_branchmergeproposal.py | |||
353 | index bf5bdb3..2e3055a 100644 | |||
354 | --- a/lib/lp/code/browser/tests/test_branchmergeproposal.py | |||
355 | +++ b/lib/lp/code/browser/tests/test_branchmergeproposal.py | |||
356 | @@ -322,13 +322,13 @@ class TestBranchMergeProposalVoteView(TestCaseWithFactory): | |||
357 | 322 | owner=reviewer, | 322 | owner=reviewer, |
358 | 323 | subject=self.factory.getUniqueString('subject'), | 323 | subject=self.factory.getUniqueString('subject'), |
359 | 324 | vote=vote, | 324 | vote=vote, |
361 | 325 | _date_created=self.date_generator.next()) | 325 | _date_created=next(self.date_generator)) |
362 | 326 | 326 | ||
363 | 327 | def _nominateReviewer(self, reviewer, registrant): | 327 | def _nominateReviewer(self, reviewer, registrant): |
364 | 328 | """Nominate a reviewer for the merge proposal.""" | 328 | """Nominate a reviewer for the merge proposal.""" |
365 | 329 | self.bmp.nominateReviewer( | 329 | self.bmp.nominateReviewer( |
366 | 330 | reviewer=reviewer, registrant=registrant, | 330 | reviewer=reviewer, registrant=registrant, |
368 | 331 | _date_created=self.date_generator.next()) | 331 | _date_created=next(self.date_generator)) |
369 | 332 | 332 | ||
370 | 333 | def testNoVotes(self): | 333 | def testNoVotes(self): |
371 | 334 | # No votes should return empty lists | 334 | # No votes should return empty lists |
372 | diff --git a/lib/lp/code/browser/tests/test_sourcepackagerecipe.py b/lib/lp/code/browser/tests/test_sourcepackagerecipe.py | |||
373 | index 97c7a1a..3b1124a 100644 | |||
374 | --- a/lib/lp/code/browser/tests/test_sourcepackagerecipe.py | |||
375 | +++ b/lib/lp/code/browser/tests/test_sourcepackagerecipe.py | |||
376 | @@ -1362,12 +1362,12 @@ class TestSourcePackageRecipeViewMixin: | |||
377 | 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. |
378 | 1363 | date_gen = time_counter( | 1363 | date_gen = time_counter( |
379 | 1364 | datetime(2010, 3, 16, tzinfo=UTC), timedelta(days=1)) | 1364 | datetime(2010, 3, 16, tzinfo=UTC), timedelta(days=1)) |
386 | 1365 | build1 = self.makeBuildJob(recipe, date_gen.next()) | 1365 | build1 = self.makeBuildJob(recipe, next(date_gen)) |
387 | 1366 | build2 = self.makeBuildJob(recipe, date_gen.next()) | 1366 | build2 = self.makeBuildJob(recipe, next(date_gen)) |
388 | 1367 | build3 = self.makeBuildJob(recipe, date_gen.next()) | 1367 | build3 = self.makeBuildJob(recipe, next(date_gen)) |
389 | 1368 | build4 = self.makeBuildJob(recipe, date_gen.next()) | 1368 | build4 = self.makeBuildJob(recipe, next(date_gen)) |
390 | 1369 | build5 = self.makeBuildJob(recipe, date_gen.next()) | 1369 | build5 = self.makeBuildJob(recipe, next(date_gen)) |
391 | 1370 | build6 = self.makeBuildJob(recipe, date_gen.next()) | 1370 | build6 = self.makeBuildJob(recipe, next(date_gen)) |
392 | 1371 | view = SourcePackageRecipeView(recipe, None) | 1371 | view = SourcePackageRecipeView(recipe, None) |
393 | 1372 | self.assertEqual( | 1372 | self.assertEqual( |
394 | 1373 | [build6, build5, build4, build3, build2, build1], | 1373 | [build6, build5, build4, build3, build2, build1], |
395 | diff --git a/lib/lp/code/doc/branch.txt b/lib/lp/code/doc/branch.txt | |||
396 | index e9c654c..c1142c0 100644 | |||
397 | --- a/lib/lp/code/doc/branch.txt | |||
398 | +++ b/lib/lp/code/doc/branch.txt | |||
399 | @@ -193,7 +193,7 @@ order. | |||
400 | 193 | ... """Create """ | 193 | ... """Create """ |
401 | 194 | ... new_branch = factory.makeProductBranch( | 194 | ... new_branch = factory.makeProductBranch( |
402 | 195 | ... branch_type=branch_type, owner=owner, product=product, | 195 | ... branch_type=branch_type, owner=owner, product=product, |
404 | 196 | ... name=name, date_created=time_generator.next()) | 196 | ... name=name, date_created=next(time_generator)) |
405 | 197 | ... new_branch.last_scanned = new_branch.date_created | 197 | ... new_branch.last_scanned = new_branch.date_created |
406 | 198 | 198 | ||
407 | 199 | >>> make_new_scanned_branch('oldest') | 199 | >>> make_new_scanned_branch('oldest') |
408 | diff --git a/lib/lp/code/doc/codeimport-result.txt b/lib/lp/code/doc/codeimport-result.txt | |||
409 | index 39fe511..fd0b617 100644 | |||
410 | --- a/lib/lp/code/doc/codeimport-result.txt | |||
411 | +++ b/lib/lp/code/doc/codeimport-result.txt | |||
412 | @@ -53,7 +53,7 @@ Then create a result object. | |||
413 | 53 | >>> from lp.code.enums import CodeImportResultStatus | 53 | >>> from lp.code.enums import CodeImportResultStatus |
414 | 54 | >>> new_result = factory.makeCodeImportResult( | 54 | >>> new_result = factory.makeCodeImportResult( |
415 | 55 | ... sample_import, result_status=CodeImportResultStatus.SUCCESS, | 55 | ... sample_import, result_status=CodeImportResultStatus.SUCCESS, |
417 | 56 | ... date_started=time_source.next(), log_excerpt=log_excerpt, | 56 | ... date_started=next(time_source), log_excerpt=log_excerpt, |
418 | 57 | ... log_alias=log_alias, machine=odin) | 57 | ... log_alias=log_alias, machine=odin) |
419 | 58 | >>> verifyObject(ICodeImportResult, new_result) | 58 | >>> verifyObject(ICodeImportResult, new_result) |
420 | 59 | True | 59 | True |
421 | @@ -95,9 +95,9 @@ method works as expected. | |||
422 | 95 | 95 | ||
423 | 96 | >>> oldest_result = new_result | 96 | >>> oldest_result = new_result |
424 | 97 | >>> middle_result = factory.makeCodeImportResult( | 97 | >>> middle_result = factory.makeCodeImportResult( |
426 | 98 | ... sample_import, date_started = time_source.next()) | 98 | ... sample_import, date_started = next(time_source)) |
427 | 99 | >>> newest_result = factory.makeCodeImportResult( | 99 | >>> newest_result = factory.makeCodeImportResult( |
429 | 100 | ... sample_import, date_started = time_source.next()) | 100 | ... sample_import, date_started = next(time_source)) |
430 | 101 | 101 | ||
431 | 102 | Results for other imports of course should not be present in the | 102 | Results for other imports of course should not be present in the |
432 | 103 | results, so we should create one of those just to be sure that it's | 103 | results, so we should create one of those just to be sure that it's |
433 | diff --git a/lib/lp/code/model/branchnamespace.py b/lib/lp/code/model/branchnamespace.py | |||
434 | index 33f3305..95f70fc 100644 | |||
435 | --- a/lib/lp/code/model/branchnamespace.py | |||
436 | +++ b/lib/lp/code/model/branchnamespace.py | |||
437 | @@ -489,7 +489,7 @@ class BranchNamespaceSet: | |||
438 | 489 | 489 | ||
439 | 490 | def get_next_segment(): | 490 | def get_next_segment(): |
440 | 491 | try: | 491 | try: |
442 | 492 | result = segments.next() | 492 | result = next(segments) |
443 | 493 | except StopIteration: | 493 | except StopIteration: |
444 | 494 | raise InvalidNamespace('/'.join(traversed_segments)) | 494 | raise InvalidNamespace('/'.join(traversed_segments)) |
445 | 495 | if result is None: | 495 | if result is None: |
446 | diff --git a/lib/lp/code/model/gitlookup.py b/lib/lp/code/model/gitlookup.py | |||
447 | index 9c01af4..29efe5f 100644 | |||
448 | --- a/lib/lp/code/model/gitlookup.py | |||
449 | +++ b/lib/lp/code/model/gitlookup.py | |||
450 | @@ -255,14 +255,14 @@ class DistributionOCIProjectGitTraversable(_BaseGitTraversable): | |||
451 | 255 | ociprojectname=self.context.ociprojectname) | 255 | ociprojectname=self.context.ociprojectname) |
452 | 256 | 256 | ||
453 | 257 | 257 | ||
455 | 258 | class SegmentIterator: | 258 | class SegmentIterator(six.Iterator): |
456 | 259 | """An iterator that remembers the elements it has traversed.""" | 259 | """An iterator that remembers the elements it has traversed.""" |
457 | 260 | 260 | ||
458 | 261 | def __init__(self, iterator): | 261 | def __init__(self, iterator): |
459 | 262 | self._iterator = iterator | 262 | self._iterator = iterator |
460 | 263 | self.traversed = [] | 263 | self.traversed = [] |
461 | 264 | 264 | ||
463 | 265 | def next(self): | 265 | def __next__(self): |
464 | 266 | segment = six.ensure_text(next(self._iterator), encoding="US-ASCII") | 266 | segment = six.ensure_text(next(self._iterator), encoding="US-ASCII") |
465 | 267 | self.traversed.append(segment) | 267 | self.traversed.append(segment) |
466 | 268 | return segment | 268 | return segment |
467 | diff --git a/lib/lp/code/model/tests/test_branchcloud.py b/lib/lp/code/model/tests/test_branchcloud.py | |||
468 | index f0e8038..6c9cfbf 100644 | |||
469 | --- a/lib/lp/code/model/tests/test_branchcloud.py | |||
470 | +++ b/lib/lp/code/model/tests/test_branchcloud.py | |||
471 | @@ -119,7 +119,7 @@ class TestBranchCloud(TestCaseWithFactory): | |||
472 | 119 | store = Store.of(product) | 119 | store = Store.of(product) |
473 | 120 | for i in range(4): | 120 | for i in range(4): |
474 | 121 | revision = self.factory.makeRevision( | 121 | revision = self.factory.makeRevision( |
476 | 122 | revision_date=date_generator.next()) | 122 | revision_date=next(date_generator)) |
477 | 123 | cache = RevisionCache(revision) | 123 | cache = RevisionCache(revision) |
478 | 124 | cache.product = product | 124 | cache.product = product |
479 | 125 | store.add(cache) | 125 | store.add(cache) |
480 | diff --git a/lib/lp/code/model/tests/test_codeimport.py b/lib/lp/code/model/tests/test_codeimport.py | |||
481 | index 1e36b30..a57f79e 100644 | |||
482 | --- a/lib/lp/code/model/tests/test_codeimport.py | |||
483 | +++ b/lib/lp/code/model/tests/test_codeimport.py | |||
484 | @@ -532,11 +532,11 @@ class TestCodeImportResultsAttribute(TestCodeImportBase): | |||
485 | 532 | origin=datetime(2007, 9, 9, 12, tzinfo=pytz.UTC), | 532 | origin=datetime(2007, 9, 9, 12, tzinfo=pytz.UTC), |
486 | 533 | delta=timedelta(days=1)) | 533 | delta=timedelta(days=1)) |
487 | 534 | first = self.factory.makeCodeImportResult( | 534 | first = self.factory.makeCodeImportResult( |
489 | 535 | self.code_import, date_started=when.next()) | 535 | self.code_import, date_started=next(when)) |
490 | 536 | second = self.factory.makeCodeImportResult( | 536 | second = self.factory.makeCodeImportResult( |
492 | 537 | self.code_import, date_started=when.next()) | 537 | self.code_import, date_started=next(when)) |
493 | 538 | third = self.factory.makeCodeImportResult( | 538 | third = self.factory.makeCodeImportResult( |
495 | 539 | self.code_import, date_started=when.next()) | 539 | self.code_import, date_started=next(when)) |
496 | 540 | self.assertTrue(first.date_job_started < second.date_job_started) | 540 | self.assertTrue(first.date_job_started < second.date_job_started) |
497 | 541 | self.assertTrue(second.date_job_started < third.date_job_started) | 541 | self.assertTrue(second.date_job_started < third.date_job_started) |
498 | 542 | results = list(self.code_import.results) | 542 | results = list(self.code_import.results) |
499 | @@ -552,11 +552,11 @@ class TestCodeImportResultsAttribute(TestCodeImportBase): | |||
500 | 552 | origin=datetime(2007, 9, 11, 12, tzinfo=pytz.UTC), | 552 | origin=datetime(2007, 9, 11, 12, tzinfo=pytz.UTC), |
501 | 553 | delta=timedelta(days=-1)) | 553 | delta=timedelta(days=-1)) |
502 | 554 | first = self.factory.makeCodeImportResult( | 554 | first = self.factory.makeCodeImportResult( |
504 | 555 | self.code_import, date_started=when.next()) | 555 | self.code_import, date_started=next(when)) |
505 | 556 | second = self.factory.makeCodeImportResult( | 556 | second = self.factory.makeCodeImportResult( |
507 | 557 | self.code_import, date_started=when.next()) | 557 | self.code_import, date_started=next(when)) |
508 | 558 | third = self.factory.makeCodeImportResult( | 558 | third = self.factory.makeCodeImportResult( |
510 | 559 | self.code_import, date_started=when.next()) | 559 | self.code_import, date_started=next(when)) |
511 | 560 | self.assertTrue(first.date_job_started > second.date_job_started) | 560 | self.assertTrue(first.date_job_started > second.date_job_started) |
512 | 561 | self.assertTrue(second.date_job_started > third.date_job_started) | 561 | self.assertTrue(second.date_job_started > third.date_job_started) |
513 | 562 | results = list(self.code_import.results) | 562 | results = list(self.code_import.results) |
514 | diff --git a/lib/lp/code/model/tests/test_revision.py b/lib/lp/code/model/tests/test_revision.py | |||
515 | index 5976f4e..67fd745 100644 | |||
516 | --- a/lib/lp/code/model/tests/test_revision.py | |||
517 | +++ b/lib/lp/code/model/tests/test_revision.py | |||
518 | @@ -369,7 +369,7 @@ class GetPublicRevisionsTestCase(TestCaseWithFactory): | |||
519 | 369 | def _makeRevision(self, revision_date=None): | 369 | def _makeRevision(self, revision_date=None): |
520 | 370 | """Make a revision using the date generator.""" | 370 | """Make a revision using the date generator.""" |
521 | 371 | if revision_date is None: | 371 | if revision_date is None: |
523 | 372 | revision_date = self.date_generator.next() | 372 | revision_date = next(self.date_generator) |
524 | 373 | return self.factory.makeRevision( | 373 | return self.factory.makeRevision( |
525 | 374 | revision_date=revision_date) | 374 | revision_date=revision_date) |
526 | 375 | 375 | ||
527 | @@ -477,7 +477,7 @@ class TestGetPublicRevisionsForPerson(GetPublicRevisionsTestCase, | |||
528 | 477 | 477 | ||
529 | 478 | `author` defaults to self.author if not set.""" | 478 | `author` defaults to self.author if not set.""" |
530 | 479 | if revision_date is None: | 479 | if revision_date is None: |
532 | 480 | revision_date = self.date_generator.next() | 480 | revision_date = next(self.date_generator) |
533 | 481 | if author is None: | 481 | if author is None: |
534 | 482 | author = self.author | 482 | author = self.author |
535 | 483 | return self.factory.makeRevision( | 483 | return self.factory.makeRevision( |
536 | @@ -955,7 +955,7 @@ class TestPruneRevisionCache(RevisionCacheTestCase): | |||
537 | 955 | delta=timedelta(days=2)) | 955 | delta=timedelta(days=2)) |
538 | 956 | for i in range(4): | 956 | for i in range(4): |
539 | 957 | revision = self.factory.makeRevision( | 957 | revision = self.factory.makeRevision( |
541 | 958 | revision_date=date_generator.next()) | 958 | revision_date=next(date_generator)) |
542 | 959 | cache = RevisionCache(revision) | 959 | cache = RevisionCache(revision) |
543 | 960 | self.store.add(cache) | 960 | self.store.add(cache) |
544 | 961 | RevisionSet.pruneRevisionCache(5) | 961 | RevisionSet.pruneRevisionCache(5) |
545 | @@ -968,7 +968,7 @@ class TestPruneRevisionCache(RevisionCacheTestCase): | |||
546 | 968 | delta=timedelta(days=2)) | 968 | delta=timedelta(days=2)) |
547 | 969 | for i in range(4): | 969 | for i in range(4): |
548 | 970 | revision = self.factory.makeRevision( | 970 | revision = self.factory.makeRevision( |
550 | 971 | revision_date=date_generator.next()) | 971 | revision_date=next(date_generator)) |
551 | 972 | cache = RevisionCache(revision) | 972 | cache = RevisionCache(revision) |
552 | 973 | self.store.add(cache) | 973 | self.store.add(cache) |
553 | 974 | RevisionSet.pruneRevisionCache(1) | 974 | RevisionSet.pruneRevisionCache(1) |
554 | diff --git a/lib/lp/code/model/tests/test_revisioncache.py b/lib/lp/code/model/tests/test_revisioncache.py | |||
555 | index 00e60d5..2f5ea2d 100644 | |||
556 | --- a/lib/lp/code/model/tests/test_revisioncache.py | |||
557 | +++ b/lib/lp/code/model/tests/test_revisioncache.py | |||
558 | @@ -114,7 +114,7 @@ class TestRevisionCache(TestCaseWithFactory): | |||
559 | 114 | # query is the reverse order. | 114 | # query is the reverse order. |
560 | 115 | revisions = [ | 115 | revisions = [ |
561 | 116 | self.makeCachedRevision( | 116 | self.makeCachedRevision( |
563 | 117 | revision=self.factory.makeRevision(revision_date=tc.next())) | 117 | revision=self.factory.makeRevision(revision_date=next(tc))) |
564 | 118 | for i in range(4)] | 118 | for i in range(4)] |
565 | 119 | revisions.reverse() | 119 | revisions.reverse() |
566 | 120 | cache = getUtility(IRevisionCache) | 120 | cache = getUtility(IRevisionCache) |
567 | @@ -142,7 +142,7 @@ class TestRevisionCache(TestCaseWithFactory): | |||
568 | 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. |
569 | 143 | for i in range(4): | 143 | for i in range(4): |
570 | 144 | self.makeCachedRevision( | 144 | self.makeCachedRevision( |
572 | 145 | revision=self.factory.makeRevision(revision_date=tc.next())) | 145 | revision=self.factory.makeRevision(revision_date=next(tc))) |
573 | 146 | cache = getUtility(IRevisionCache) | 146 | cache = getUtility(IRevisionCache) |
574 | 147 | self.assertEqual(2, cache.count()) | 147 | self.assertEqual(2, cache.count()) |
575 | 148 | 148 | ||
576 | diff --git a/lib/lp/code/stories/branches/xx-personproduct-branch-listings.txt b/lib/lp/code/stories/branches/xx-personproduct-branch-listings.txt | |||
577 | index b9c31c5..6275b92 100644 | |||
578 | --- a/lib/lp/code/stories/branches/xx-personproduct-branch-listings.txt | |||
579 | +++ b/lib/lp/code/stories/branches/xx-personproduct-branch-listings.txt | |||
580 | @@ -27,14 +27,14 @@ that only the fooix branches are shown. | |||
581 | 27 | ... datetime(2007, 12, 1, tzinfo=pytz.UTC), timedelta(days=1)) | 27 | ... datetime(2007, 12, 1, tzinfo=pytz.UTC), timedelta(days=1)) |
582 | 28 | >>> branch = factory.makeProductBranch( | 28 | >>> branch = factory.makeProductBranch( |
583 | 29 | ... owner=eric, product=fooix, name="testing", | 29 | ... owner=eric, product=fooix, name="testing", |
585 | 30 | ... date_created=date_generator.next()) | 30 | ... date_created=next(date_generator)) |
586 | 31 | >>> branch = factory.makeProductBranch( | 31 | >>> branch = factory.makeProductBranch( |
587 | 32 | ... owner=eric, product=fooix, name="feature", | 32 | ... owner=eric, product=fooix, name="feature", |
589 | 33 | ... date_created=date_generator.next()) | 33 | ... date_created=next(date_generator)) |
590 | 34 | >>> branch = factory.makeAnyBranch( | 34 | >>> branch = factory.makeAnyBranch( |
592 | 35 | ... owner=eric, date_created=date_generator.next()) | 35 | ... owner=eric, date_created=next(date_generator)) |
593 | 36 | >>> branch = factory.makeAnyBranch( | 36 | >>> branch = factory.makeAnyBranch( |
595 | 37 | ... owner=eric, date_created=date_generator.next()) | 37 | ... owner=eric, date_created=next(date_generator)) |
596 | 38 | >>> logout() | 38 | >>> logout() |
597 | 39 | 39 | ||
598 | 40 | >>> browser.open('http://code.launchpad.test/~eric/fooix') | 40 | >>> browser.open('http://code.launchpad.test/~eric/fooix') |
599 | diff --git a/lib/lp/code/stories/feeds/xx-branch-atom.txt b/lib/lp/code/stories/feeds/xx-branch-atom.txt | |||
600 | index 7c91bca..c8e3628 100644 | |||
601 | --- a/lib/lp/code/stories/feeds/xx-branch-atom.txt | |||
602 | +++ b/lib/lp/code/stories/feeds/xx-branch-atom.txt | |||
603 | @@ -21,7 +21,7 @@ by asking BeautifulSoup to use lxml. | |||
604 | 21 | >>> def make_branch(owner, product, name): | 21 | >>> def make_branch(owner, product, name): |
605 | 22 | ... global factory, date_generator | 22 | ... global factory, date_generator |
606 | 23 | ... factory.makeProductBranch(name=name, product=product, | 23 | ... factory.makeProductBranch(name=name, product=product, |
608 | 24 | ... owner=owner, date_created=date_generator.next()) | 24 | ... owner=owner, date_created=next(date_generator)) |
609 | 25 | >>> mike = factory.makePerson(name='mike', displayname='Mike Murphy') | 25 | >>> mike = factory.makePerson(name='mike', displayname='Mike Murphy') |
610 | 26 | >>> mary = factory.makePerson(name='mary', displayname='Mary Murphy') | 26 | >>> mary = factory.makePerson(name='mary', displayname='Mary Murphy') |
611 | 27 | >>> projectgroup = factory.makeProject(name='oh-man', displayname='Oh Man') | 27 | >>> projectgroup = factory.makeProject(name='oh-man', displayname='Oh Man') |
612 | diff --git a/lib/lp/code/stories/feeds/xx-revision-atom.txt b/lib/lp/code/stories/feeds/xx-revision-atom.txt | |||
613 | index 0fadb05..3079a35 100644 | |||
614 | --- a/lib/lp/code/stories/feeds/xx-revision-atom.txt | |||
615 | +++ b/lib/lp/code/stories/feeds/xx-revision-atom.txt | |||
616 | @@ -37,7 +37,7 @@ by asking BeautifulSoup to use lxml. | |||
617 | 37 | ... global factory, date_generator | 37 | ... global factory, date_generator |
618 | 38 | ... return factory.makeRevision( | 38 | ... return factory.makeRevision( |
619 | 39 | ... author=removeSecurityProxy(author).preferredemail.email, | 39 | ... author=removeSecurityProxy(author).preferredemail.email, |
621 | 40 | ... revision_date=date_generator.next(), | 40 | ... revision_date=next(date_generator), |
622 | 41 | ... rev_id=rev_id, log_body=log_body) | 41 | ... rev_id=rev_id, log_body=log_body) |
623 | 42 | >>> ignored = fooey_branch.createBranchRevision( | 42 | >>> ignored = fooey_branch.createBranchRevision( |
624 | 43 | ... 1, makeRevision( | 43 | ... 1, makeRevision( |
625 | diff --git a/lib/lp/code/tests/codeimporthelpers.py b/lib/lp/code/tests/codeimporthelpers.py | |||
626 | index 34110cb..3e177f6 100644 | |||
627 | --- a/lib/lp/code/tests/codeimporthelpers.py | |||
628 | +++ b/lib/lp/code/tests/codeimporthelpers.py | |||
629 | @@ -132,5 +132,5 @@ def make_all_result_types(code_import, factory, machine, start, count): | |||
630 | 132 | for result_status in sorted(CodeImportResultStatus.items)[ | 132 | for result_status in sorted(CodeImportResultStatus.items)[ |
631 | 133 | start:start + count]: | 133 | start:start + count]: |
632 | 134 | factory.makeCodeImportResult( | 134 | factory.makeCodeImportResult( |
634 | 135 | code_import, result_status, start_dates.next(), end_dates.next(), | 135 | code_import, result_status, next(start_dates), next(end_dates), |
635 | 136 | machine=machine) | 136 | machine=machine) |
636 | diff --git a/lib/lp/code/tests/helpers.py b/lib/lp/code/tests/helpers.py | |||
637 | index 2955528..46f12ed 100644 | |||
638 | --- a/lib/lp/code/tests/helpers.py | |||
639 | +++ b/lib/lp/code/tests/helpers.py | |||
640 | @@ -160,7 +160,7 @@ def consistent_branch_names(): | |||
641 | 160 | yield name | 160 | yield name |
642 | 161 | index = count(1) | 161 | index = count(1) |
643 | 162 | while True: | 162 | while True: |
645 | 163 | yield "branch-%s" % index.next() | 163 | yield "branch-%s" % next(index) |
646 | 164 | 164 | ||
647 | 165 | 165 | ||
648 | 166 | def make_package_branches(factory, series, sourcepackagename, branch_count, | 166 | def make_package_branches(factory, series, sourcepackagename, branch_count, |
649 | @@ -180,8 +180,8 @@ def make_package_branches(factory, series, sourcepackagename, branch_count, | |||
650 | 180 | factory.makePackageBranch( | 180 | factory.makePackageBranch( |
651 | 181 | distroseries=series, | 181 | distroseries=series, |
652 | 182 | sourcepackagename=sourcepackagename, | 182 | sourcepackagename=sourcepackagename, |
655 | 183 | date_created=time_gen.next(), | 183 | date_created=next(time_gen), |
656 | 184 | name=branch_names.next(), owner=owner, registrant=registrant) | 184 | name=next(branch_names), owner=owner, registrant=registrant) |
657 | 185 | for i in range(branch_count)] | 185 | for i in range(branch_count)] |
658 | 186 | 186 | ||
659 | 187 | official = [] | 187 | official = [] |
660 | diff --git a/lib/lp/code/vocabularies/branch.py b/lib/lp/code/vocabularies/branch.py | |||
661 | index bd828ae..db4a39e 100644 | |||
662 | --- a/lib/lp/code/vocabularies/branch.py | |||
663 | +++ b/lib/lp/code/vocabularies/branch.py | |||
664 | @@ -47,7 +47,7 @@ class BranchVocabulary(SQLObjectVocabularyBase): | |||
665 | 47 | """See `IVocabularyTokenized`.""" | 47 | """See `IVocabularyTokenized`.""" |
666 | 48 | search_results = self.searchForTerms(token) | 48 | search_results = self.searchForTerms(token) |
667 | 49 | if search_results.count() == 1: | 49 | if search_results.count() == 1: |
669 | 50 | return iter(search_results).next() | 50 | return next(iter(search_results)) |
670 | 51 | raise LookupError(token) | 51 | raise LookupError(token) |
671 | 52 | 52 | ||
672 | 53 | def searchForTerms(self, query=None, vocab_filter=None): | 53 | def searchForTerms(self, query=None, vocab_filter=None): |
673 | diff --git a/lib/lp/code/vocabularies/gitrepository.py b/lib/lp/code/vocabularies/gitrepository.py | |||
674 | index 80f6524..0fc86d0 100644 | |||
675 | --- a/lib/lp/code/vocabularies/gitrepository.py | |||
676 | +++ b/lib/lp/code/vocabularies/gitrepository.py | |||
677 | @@ -43,7 +43,7 @@ class GitRepositoryVocabulary(StormVocabularyBase): | |||
678 | 43 | """See `IVocabularyTokenized`.""" | 43 | """See `IVocabularyTokenized`.""" |
679 | 44 | search_results = self.searchForTerms(token) | 44 | search_results = self.searchForTerms(token) |
680 | 45 | if search_results.count() == 1: | 45 | if search_results.count() == 1: |
682 | 46 | return iter(search_results).next() | 46 | return next(iter(search_results)) |
683 | 47 | raise LookupError(token) | 47 | raise LookupError(token) |
684 | 48 | 48 | ||
685 | 49 | def searchForTerms(self, query=None, vocab_filter=None): | 49 | def searchForTerms(self, query=None, vocab_filter=None): |
686 | diff --git a/lib/lp/codehosting/scanner/mergedetection.py b/lib/lp/codehosting/scanner/mergedetection.py | |||
687 | index 0e5dcd5..c73cd52 100644 | |||
688 | --- a/lib/lp/codehosting/scanner/mergedetection.py | |||
689 | +++ b/lib/lp/codehosting/scanner/mergedetection.py | |||
690 | @@ -127,7 +127,7 @@ def find_merged_revno(merge_sorted, tip_rev_id): | |||
691 | 127 | iterator = iter(merge_sorted) | 127 | iterator = iter(merge_sorted) |
692 | 128 | while True: | 128 | while True: |
693 | 129 | try: | 129 | try: |
695 | 130 | rev_id, depth, revno, ignored = iterator.next() | 130 | rev_id, depth, revno, ignored = next(iterator) |
696 | 131 | except StopIteration: | 131 | except StopIteration: |
697 | 132 | break | 132 | break |
698 | 133 | if depth == 0: | 133 | if depth == 0: |
699 | diff --git a/lib/lp/codehosting/sftp.py b/lib/lp/codehosting/sftp.py | |||
700 | index 51d42e7..3c9dfb7 100644 | |||
701 | --- a/lib/lp/codehosting/sftp.py | |||
702 | +++ b/lib/lp/codehosting/sftp.py | |||
703 | @@ -31,6 +31,7 @@ from breezy import ( | |||
704 | 31 | ) | 31 | ) |
705 | 32 | from breezy.transport.local import LocalTransport | 32 | from breezy.transport.local import LocalTransport |
706 | 33 | from lazr.sshserver.sftp import FileIsADirectory | 33 | from lazr.sshserver.sftp import FileIsADirectory |
707 | 34 | import six | ||
708 | 34 | from twisted.conch.interfaces import ( | 35 | from twisted.conch.interfaces import ( |
709 | 35 | ISFTPFile, | 36 | ISFTPFile, |
710 | 36 | ISFTPServer, | 37 | ISFTPServer, |
711 | @@ -97,7 +98,7 @@ def with_sftp_error(func): | |||
712 | 97 | return util.mergeFunctionMetadata(func, decorator) | 98 | return util.mergeFunctionMetadata(func, decorator) |
713 | 98 | 99 | ||
714 | 99 | 100 | ||
716 | 100 | class DirectoryListing: | 101 | class DirectoryListing(six.Iterator): |
717 | 101 | """Class to satisfy openDirectory return interface. | 102 | """Class to satisfy openDirectory return interface. |
718 | 102 | 103 | ||
719 | 103 | openDirectory returns an iterator -- with a `close` method. Hence | 104 | openDirectory returns an iterator -- with a `close` method. Hence |
720 | @@ -110,8 +111,8 @@ class DirectoryListing: | |||
721 | 110 | def __iter__(self): | 111 | def __iter__(self): |
722 | 111 | return self | 112 | return self |
723 | 112 | 113 | ||
726 | 113 | def next(self): | 114 | def __next__(self): |
727 | 114 | return self.iter.next() | 115 | return next(self.iter) |
728 | 115 | 116 | ||
729 | 116 | def close(self): | 117 | def close(self): |
730 | 117 | # I can't believe we had to implement a whole class just to | 118 | # I can't believe we had to implement a whole class just to |
731 | @@ -191,7 +192,7 @@ class TransportSFTPFile: | |||
732 | 191 | self._escaped_path, [(offset, length)]) | 192 | self._escaped_path, [(offset, length)]) |
733 | 192 | 193 | ||
734 | 193 | def get_first_chunk(read_things): | 194 | def get_first_chunk(read_things): |
736 | 194 | return read_things.next()[1] | 195 | return next(read_things)[1] |
737 | 195 | 196 | ||
738 | 196 | def handle_short_read(failure): | 197 | def handle_short_read(failure): |
739 | 197 | """Handle short reads by reading what was available. | 198 | """Handle short reads by reading what was available. |
740 | diff --git a/lib/lp/codehosting/vfs/tests/test_branchfs.py b/lib/lp/codehosting/vfs/tests/test_branchfs.py | |||
741 | index 0aa7fe7..9e0896b 100644 | |||
742 | --- a/lib/lp/codehosting/vfs/tests/test_branchfs.py | |||
743 | +++ b/lib/lp/codehosting/vfs/tests/test_branchfs.py | |||
744 | @@ -607,7 +607,7 @@ class LaunchpadTransportTests: | |||
745 | 607 | [(3, 2)]) | 607 | [(3, 2)]) |
746 | 608 | 608 | ||
747 | 609 | def get_chunk(generator): | 609 | def get_chunk(generator): |
749 | 610 | return generator.next()[1] | 610 | return next(generator)[1] |
750 | 611 | deferred.addCallback(get_chunk) | 611 | deferred.addCallback(get_chunk) |
751 | 612 | return deferred.addCallback(self.assertEqual, data[3:5]) | 612 | return deferred.addCallback(self.assertEqual, data[3:5]) |
752 | 613 | 613 | ||
753 | diff --git a/lib/lp/registry/doc/person-merge.txt b/lib/lp/registry/doc/person-merge.txt | |||
754 | index 55d627a..ffb12b9 100644 | |||
755 | --- a/lib/lp/registry/doc/person-merge.txt | |||
756 | +++ b/lib/lp/registry/doc/person-merge.txt | |||
757 | @@ -294,7 +294,7 @@ create, and then delete, the needed two people. | |||
758 | 294 | 294 | ||
759 | 295 | First, we will test a merge where there is no decoration. | 295 | First, we will test a merge where there is no decoration. |
760 | 296 | 296 | ||
762 | 297 | >>> winner, loser = endless_supply_of_players.next() | 297 | >>> winner, loser = next(endless_supply_of_players) |
763 | 298 | >>> print decorator_refs(store, winner, loser) | 298 | >>> print decorator_refs(store, winner, loser) |
764 | 299 | <BLANKLINE> | 299 | <BLANKLINE> |
765 | 300 | 300 | ||
766 | @@ -316,7 +316,7 @@ There should still be no columns that reference the winner or loser. | |||
767 | 316 | OK, now, this time, we will add some decorator information to the winner | 316 | OK, now, this time, we will add some decorator information to the winner |
768 | 317 | but not the loser. | 317 | but not the loser. |
769 | 318 | 318 | ||
771 | 319 | >>> winner, loser = endless_supply_of_players.next() | 319 | >>> winner, loser = next(endless_supply_of_players) |
772 | 320 | >>> winner.setLocation(None, None, 'America/Santiago', winner) | 320 | >>> winner.setLocation(None, None, 'America/Santiago', winner) |
773 | 321 | >>> print decorator_refs(store, winner, loser) | 321 | >>> print decorator_refs(store, winner, loser) |
774 | 322 | winner, winner, | 322 | winner, winner, |
775 | @@ -333,7 +333,7 @@ the winner: | |||
776 | 333 | This time, we will have a decorator for the person that is being merged | 333 | This time, we will have a decorator for the person that is being merged |
777 | 334 | INTO another person, but nothing on the target person. | 334 | INTO another person, but nothing on the target person. |
778 | 335 | 335 | ||
780 | 336 | >>> winner, loser = endless_supply_of_players.next() | 336 | >>> winner, loser = next(endless_supply_of_players) |
781 | 337 | >>> loser.setLocation(None, None, 'America/Santiago', loser) | 337 | >>> loser.setLocation(None, None, 'America/Santiago', loser) |
782 | 338 | >>> print decorator_refs(store, winner, loser) | 338 | >>> print decorator_refs(store, winner, loser) |
783 | 339 | loser, loser, | 339 | loser, loser, |
784 | @@ -352,7 +352,7 @@ to_person and the from_person. We expect that the from_person record | |||
785 | 352 | will remain as noise but non-unique columns will have been updated to | 352 | will remain as noise but non-unique columns will have been updated to |
786 | 353 | point to the winner, and the to_person will be unaffected. | 353 | point to the winner, and the to_person will be unaffected. |
787 | 354 | 354 | ||
789 | 355 | >>> winner, loser = endless_supply_of_players.next() | 355 | >>> winner, loser = next(endless_supply_of_players) |
790 | 356 | >>> winner.setLocation(None, None, 'America/Santiago', winner) | 356 | >>> winner.setLocation(None, None, 'America/Santiago', winner) |
791 | 357 | >>> loser.setLocation(None, None, 'America/New_York', loser) | 357 | >>> loser.setLocation(None, None, 'America/New_York', loser) |
792 | 358 | >>> print decorator_refs(store, winner, loser) | 358 | >>> print decorator_refs(store, winner, loser) |
793 | diff --git a/lib/lp/registry/doc/standing.txt b/lib/lp/registry/doc/standing.txt | |||
794 | index 1678d43..fa3df52 100644 | |||
795 | --- a/lib/lp/registry/doc/standing.txt | |||
796 | +++ b/lib/lp/registry/doc/standing.txt | |||
797 | @@ -41,7 +41,7 @@ are not a member of, their message gets held for moderator approval. | |||
798 | 41 | ... Date: %s | 41 | ... Date: %s |
799 | 42 | ... | 42 | ... |
800 | 43 | ... Point of order! | 43 | ... Point of order! |
802 | 44 | ... """ % (from_address, to_team_name, message_ids.next(), formatdate())) | 44 | ... """ % (from_address, to_team_name, next(message_ids), formatdate())) |
803 | 45 | ... mailing_list = getUtility(IMailingListSet).get(to_team_name) | 45 | ... mailing_list = getUtility(IMailingListSet).get(to_team_name) |
804 | 46 | ... held_message = mailing_list.holdMessage(message) | 46 | ... held_message = mailing_list.holdMessage(message) |
805 | 47 | ... return held_message | 47 | ... return held_message |
806 | diff --git a/lib/lp/registry/tests/test_milestonetag.py b/lib/lp/registry/tests/test_milestonetag.py | |||
807 | index 93ab917..d3cad1e 100644 | |||
808 | --- a/lib/lp/registry/tests/test_milestonetag.py | |||
809 | +++ b/lib/lp/registry/tests/test_milestonetag.py | |||
810 | @@ -70,7 +70,7 @@ class MilestoneTagTest(TestCaseWithFactory): | |||
811 | 70 | MilestoneTag.created_by_id, | 70 | MilestoneTag.created_by_id, |
812 | 71 | MilestoneTag.date_created, | 71 | MilestoneTag.date_created, |
813 | 72 | ) | 72 | ) |
815 | 73 | created_by_id, date_created = values.next() | 73 | created_by_id, date_created = next(values) |
816 | 74 | self.assertEqual(self.person.id, created_by_id) | 74 | self.assertEqual(self.person.id, created_by_id) |
817 | 75 | self.assertIsInstance(date_created, datetime.datetime) | 75 | self.assertIsInstance(date_created, datetime.datetime) |
818 | 76 | 76 | ||
819 | diff --git a/lib/lp/services/apachelogparser/base.py b/lib/lp/services/apachelogparser/base.py | |||
820 | index 8f3a438..f2e556a 100644 | |||
821 | --- a/lib/lp/services/apachelogparser/base.py | |||
822 | +++ b/lib/lp/services/apachelogparser/base.py | |||
823 | @@ -112,7 +112,7 @@ def parse_file(fd, start_position, logger, get_download_key, parsed_lines=0): | |||
824 | 112 | # logfile that has been rotated already, so it should be safe to | 112 | # logfile that has been rotated already, so it should be safe to |
825 | 113 | # parse its last line. | 113 | # parse its last line. |
826 | 114 | try: | 114 | try: |
828 | 115 | next_line = fd.next() | 115 | next_line = next(fd) |
829 | 116 | except StopIteration: | 116 | except StopIteration: |
830 | 117 | if parsed_lines > 0: | 117 | if parsed_lines > 0: |
831 | 118 | break | 118 | break |
832 | diff --git a/lib/lp/services/doc/propertycache.txt b/lib/lp/services/doc/propertycache.txt | |||
833 | index a4f2097..cd1fadf 100644 | |||
834 | --- a/lib/lp/services/doc/propertycache.txt | |||
835 | +++ b/lib/lp/services/doc/propertycache.txt | |||
836 | @@ -17,7 +17,7 @@ and then returned each time it is asked for. | |||
837 | 17 | >>> class Foo(object): | 17 | >>> class Foo(object): |
838 | 18 | ... @cachedproperty | 18 | ... @cachedproperty |
839 | 19 | ... def bar(self): | 19 | ... def bar(self): |
841 | 20 | ... return counter.next() | 20 | ... return next(counter) |
842 | 21 | 21 | ||
843 | 22 | >>> foo = Foo() | 22 | >>> foo = Foo() |
844 | 23 | 23 | ||
845 | diff --git a/lib/lp/services/gpg/tests/test_gpghandler.py b/lib/lp/services/gpg/tests/test_gpghandler.py | |||
846 | index ca24c3b..7007553 100644 | |||
847 | --- a/lib/lp/services/gpg/tests/test_gpghandler.py | |||
848 | +++ b/lib/lp/services/gpg/tests/test_gpghandler.py | |||
849 | @@ -144,7 +144,7 @@ class TestGPGHandler(TestCase): | |||
850 | 144 | def test_non_ascii_filter(self): | 144 | def test_non_ascii_filter(self): |
851 | 145 | """localKeys should not error if passed non-ascii unicode strings.""" | 145 | """localKeys should not error if passed non-ascii unicode strings.""" |
852 | 146 | filtered_keys = self.gpg_handler.localKeys(u'non-ascii \u8463') | 146 | filtered_keys = self.gpg_handler.localKeys(u'non-ascii \u8463') |
854 | 147 | self.assertRaises(StopIteration, filtered_keys.next) | 147 | self.assertRaises(StopIteration, next, filtered_keys) |
855 | 148 | 148 | ||
856 | 149 | def testTestkeyrings(self): | 149 | def testTestkeyrings(self): |
857 | 150 | """Do we have the expected test keyring files""" | 150 | """Do we have the expected test keyring files""" |
858 | diff --git a/lib/lp/services/librarianserver/swift.py b/lib/lp/services/librarianserver/swift.py | |||
859 | index db01746..8f7f157 100644 | |||
860 | --- a/lib/lp/services/librarianserver/swift.py | |||
861 | +++ b/lib/lp/services/librarianserver/swift.py | |||
862 | @@ -309,7 +309,7 @@ class SwiftStream: | |||
863 | 309 | 309 | ||
864 | 310 | def _next_chunk(self): | 310 | def _next_chunk(self): |
865 | 311 | try: | 311 | try: |
867 | 312 | return self._chunks.next() | 312 | return next(self._chunks) |
868 | 313 | except StopIteration: | 313 | except StopIteration: |
869 | 314 | return None | 314 | return None |
870 | 315 | 315 | ||
871 | diff --git a/lib/lp/services/mail/tests/mbox_mailer.txt b/lib/lp/services/mail/tests/mbox_mailer.txt | |||
872 | index 0c67cfc..8e88bd2 100644 | |||
873 | --- a/lib/lp/services/mail/tests/mbox_mailer.txt | |||
874 | +++ b/lib/lp/services/mail/tests/mbox_mailer.txt | |||
875 | @@ -25,7 +25,7 @@ Read the mbox file and make sure the message we just mailed is in there. | |||
876 | 25 | >>> from mailbox import UnixMailbox | 25 | >>> from mailbox import UnixMailbox |
877 | 26 | >>> mbox_file = open(mbox_filename) | 26 | >>> mbox_file = open(mbox_filename) |
878 | 27 | >>> mbox = UnixMailbox(mbox_file) | 27 | >>> mbox = UnixMailbox(mbox_file) |
880 | 28 | >>> msg = mbox.next() | 28 | >>> msg = next(mbox) |
881 | 29 | >>> msg['from'] | 29 | >>> msg['from'] |
882 | 30 | 'geddy@example.com' | 30 | 'geddy@example.com' |
883 | 31 | >>> msg['to'] | 31 | >>> msg['to'] |
884 | @@ -43,7 +43,7 @@ Read the mbox file and make sure the message we just mailed is in there. | |||
885 | 43 | 43 | ||
886 | 44 | There should be no other messages in the mbox file. | 44 | There should be no other messages in the mbox file. |
887 | 45 | 45 | ||
889 | 46 | >>> mbox.next() | 46 | >>> next(mbox) |
890 | 47 | >>> mbox_file.close() | 47 | >>> mbox_file.close() |
891 | 48 | 48 | ||
892 | 49 | Create another mailer, again that overwrites. Make sure it actually does | 49 | Create another mailer, again that overwrites. Make sure it actually does |
893 | @@ -63,10 +63,10 @@ overwrite. | |||
894 | 63 | 63 | ||
895 | 64 | >>> mbox_file = open(mbox_filename) | 64 | >>> mbox_file = open(mbox_filename) |
896 | 65 | >>> mbox = UnixMailbox(mbox_file) | 65 | >>> mbox = UnixMailbox(mbox_file) |
898 | 66 | >>> msg = mbox.next() | 66 | >>> msg = next(mbox) |
899 | 67 | >>> msg['from'] | 67 | >>> msg['from'] |
900 | 68 | 'mick@example.com' | 68 | 'mick@example.com' |
902 | 69 | >>> mbox.next() | 69 | >>> next(mbox) |
903 | 70 | >>> mbox_file.close() | 70 | >>> mbox_file.close() |
904 | 71 | 71 | ||
905 | 72 | Create another mailer, this time one that does not overwrite. Both the | 72 | Create another mailer, this time one that does not overwrite. Both the |
906 | @@ -87,10 +87,10 @@ mbox file. | |||
907 | 87 | 87 | ||
908 | 88 | >>> mbox_file = open(mbox_filename) | 88 | >>> mbox_file = open(mbox_filename) |
909 | 89 | >>> mbox = UnixMailbox(mbox_file) | 89 | >>> mbox = UnixMailbox(mbox_file) |
911 | 90 | >>> msg = mbox.next() | 90 | >>> msg = next(mbox) |
912 | 91 | >>> msg['from'] | 91 | >>> msg['from'] |
913 | 92 | 'mick@example.com' | 92 | 'mick@example.com' |
915 | 93 | >>> msg = mbox.next() | 93 | >>> msg = next(mbox) |
916 | 94 | >>> msg['from'] | 94 | >>> msg['from'] |
917 | 95 | 'carol@example.com' | 95 | 'carol@example.com' |
918 | 96 | >>> mbox_file.close() | 96 | >>> mbox_file.close() |
919 | @@ -120,14 +120,14 @@ harness. | |||
920 | 120 | 120 | ||
921 | 121 | >>> mbox_file = open(mbox_filename) | 121 | >>> mbox_file = open(mbox_filename) |
922 | 122 | >>> mbox = UnixMailbox(mbox_file) | 122 | >>> mbox = UnixMailbox(mbox_file) |
924 | 123 | >>> msg = mbox.next() | 123 | >>> msg = next(mbox) |
925 | 124 | >>> msg['from'] | 124 | >>> msg['from'] |
926 | 125 | 'sting@example.com' | 125 | 'sting@example.com' |
928 | 126 | >>> msg = mbox.next() | 126 | >>> msg = next(mbox) |
929 | 127 | 127 | ||
930 | 128 | >>> mbox_file = open(chained_filename) | 128 | >>> mbox_file = open(chained_filename) |
931 | 129 | >>> mbox = UnixMailbox(mbox_file) | 129 | >>> mbox = UnixMailbox(mbox_file) |
933 | 130 | >>> msg = mbox.next() | 130 | >>> msg = next(mbox) |
934 | 131 | >>> msg['from'] | 131 | >>> msg['from'] |
935 | 132 | 'sting@example.com' | 132 | 'sting@example.com' |
937 | 133 | >>> msg = mbox.next() | 133 | >>> msg = next(mbox) |
938 | diff --git a/lib/lp/services/tests/test_utils.py b/lib/lp/services/tests/test_utils.py | |||
939 | index dd50c8f..e753a82 100644 | |||
940 | --- a/lib/lp/services/tests/test_utils.py | |||
941 | +++ b/lib/lp/services/tests/test_utils.py | |||
942 | @@ -201,8 +201,8 @@ class TestCachingIterator(TestCase): | |||
943 | 201 | ci = CachingIterator(partial(iter, [0, 1, 2, 3, 4])) | 201 | ci = CachingIterator(partial(iter, [0, 1, 2, 3, 4])) |
944 | 202 | i1 = iter(ci) | 202 | i1 = iter(ci) |
945 | 203 | i2 = iter(ci) | 203 | i2 = iter(ci) |
948 | 204 | self.assertEqual(0, i1.next()) | 204 | self.assertEqual(0, next(i1)) |
949 | 205 | self.assertEqual(0, i2.next()) | 205 | self.assertEqual(0, next(i2)) |
950 | 206 | self.assertEqual([1, 2, 3, 4], list(i2)) | 206 | self.assertEqual([1, 2, 3, 4], list(i2)) |
951 | 207 | self.assertEqual([1, 2, 3, 4], list(i1)) | 207 | self.assertEqual([1, 2, 3, 4], list(i1)) |
952 | 208 | 208 | ||
953 | diff --git a/lib/lp/services/twistedsupport/tests/test_task.py b/lib/lp/services/twistedsupport/tests/test_task.py | |||
954 | index 40abcc7..a40a31d 100644 | |||
955 | --- a/lib/lp/services/twistedsupport/tests/test_task.py | |||
956 | +++ b/lib/lp/services/twistedsupport/tests/test_task.py | |||
957 | @@ -4,6 +4,8 @@ | |||
958 | 4 | 4 | ||
959 | 5 | __metaclass__ = type | 5 | __metaclass__ = type |
960 | 6 | 6 | ||
961 | 7 | from functools import partial | ||
962 | 8 | |||
963 | 7 | from twisted.internet.defer import ( | 9 | from twisted.internet.defer import ( |
964 | 8 | Deferred, | 10 | Deferred, |
965 | 9 | succeed, | 11 | succeed, |
966 | @@ -193,7 +195,8 @@ class TestPollingTaskSource(TestCase): | |||
967 | 193 | self.factory.getUniqueString(), self.factory.getUniqueString()] | 195 | self.factory.getUniqueString(), self.factory.getUniqueString()] |
968 | 194 | consumer1_tasks = [] | 196 | consumer1_tasks = [] |
969 | 195 | consumer2_tasks = [] | 197 | consumer2_tasks = [] |
971 | 196 | task_source = self.makeTaskSource(task_producer=iter(tasks).next) | 198 | task_source = self.makeTaskSource( |
972 | 199 | task_producer=partial(next, iter(tasks))) | ||
973 | 197 | task_source.start(AppendingTaskConsumer(consumer1_tasks)) | 200 | task_source.start(AppendingTaskConsumer(consumer1_tasks)) |
974 | 198 | task_source.start(AppendingTaskConsumer(consumer2_tasks)) | 201 | task_source.start(AppendingTaskConsumer(consumer2_tasks)) |
975 | 199 | self.assertEqual( | 202 | self.assertEqual( |
976 | diff --git a/lib/lp/services/webapp/doc/canonical_url.txt b/lib/lp/services/webapp/doc/canonical_url.txt | |||
977 | index 6d3c75a..8a52aa7 100644 | |||
978 | --- a/lib/lp/services/webapp/doc/canonical_url.txt | |||
979 | +++ b/lib/lp/services/webapp/doc/canonical_url.txt | |||
980 | @@ -333,19 +333,19 @@ We have to do the tests that involve errors bit by bit, to allow the doctest | |||
981 | 333 | to work properly. | 333 | to work properly. |
982 | 334 | 334 | ||
983 | 335 | >>> iterator = canonical_url_iterator(object_that_has_no_url) | 335 | >>> iterator = canonical_url_iterator(object_that_has_no_url) |
985 | 336 | >>> iterator.next().__class__.__name__ | 336 | >>> next(iterator).__class__.__name__ |
986 | 337 | 'object' | 337 | 'object' |
988 | 338 | >>> iterator.next() | 338 | >>> next(iterator) |
989 | 339 | Traceback (most recent call last): | 339 | Traceback (most recent call last): |
990 | 340 | ... | 340 | ... |
991 | 341 | NoCanonicalUrl: No url for <...object...> because <...object...> broke the chain. | 341 | NoCanonicalUrl: No url for <...object...> because <...object...> broke the chain. |
992 | 342 | 342 | ||
993 | 343 | >>> iterator = canonical_url_iterator(unrooted_object) | 343 | >>> iterator = canonical_url_iterator(unrooted_object) |
995 | 344 | >>> iterator.next().__class__.__name__ | 344 | >>> next(iterator).__class__.__name__ |
996 | 345 | 'ObjectThatHasUrl' | 345 | 'ObjectThatHasUrl' |
998 | 346 | >>> iterator.next().__class__.__name__ | 346 | >>> next(iterator).__class__.__name__ |
999 | 347 | 'object' | 347 | 'object' |
1001 | 348 | >>> iterator.next() | 348 | >>> next(iterator) |
1002 | 349 | Traceback (most recent call last): | 349 | Traceback (most recent call last): |
1003 | 350 | ... | 350 | ... |
1004 | 351 | NoCanonicalUrl: No url for <...ObjectThatHasUrl...> because <...object...> broke the chain. | 351 | NoCanonicalUrl: No url for <...ObjectThatHasUrl...> because <...object...> broke the chain. |
1005 | diff --git a/lib/lp/services/webapp/errorlog.py b/lib/lp/services/webapp/errorlog.py | |||
1006 | index 2092e90..a64ce43 100644 | |||
1007 | --- a/lib/lp/services/webapp/errorlog.py | |||
1008 | +++ b/lib/lp/services/webapp/errorlog.py | |||
1009 | @@ -449,7 +449,7 @@ class ErrorReportingUtility: | |||
1010 | 449 | :param message: Unicode message. | 449 | :param message: Unicode message. |
1011 | 450 | :returns: Key for this message. | 450 | :returns: Key for this message. |
1012 | 451 | """ | 451 | """ |
1014 | 452 | key = self._oops_message_key_iter.next() | 452 | key = next(self._oops_message_key_iter) |
1015 | 453 | self._oops_messages[key] = message | 453 | self._oops_messages[key] = message |
1016 | 454 | return key | 454 | return key |
1017 | 455 | 455 | ||
1018 | diff --git a/lib/lp/services/webapp/servers.py b/lib/lp/services/webapp/servers.py | |||
1019 | index 33cf173..8b85df8 100644 | |||
1020 | --- a/lib/lp/services/webapp/servers.py | |||
1021 | +++ b/lib/lp/services/webapp/servers.py | |||
1022 | @@ -113,7 +113,7 @@ from lp.testopenid.interfaces.server import ITestOpenIDApplication | |||
1023 | 113 | from lp.xmlrpc.interfaces import IPrivateApplication | 113 | from lp.xmlrpc.interfaces import IPrivateApplication |
1024 | 114 | 114 | ||
1025 | 115 | 115 | ||
1027 | 116 | class StepsToGo: | 116 | class StepsToGo(six.Iterator): |
1028 | 117 | """ | 117 | """ |
1029 | 118 | 118 | ||
1030 | 119 | >>> class FakeRequest: | 119 | >>> class FakeRequest: |
1031 | @@ -195,7 +195,7 @@ class StepsToGo: | |||
1032 | 195 | except IndexError: | 195 | except IndexError: |
1033 | 196 | return None | 196 | return None |
1034 | 197 | 197 | ||
1036 | 198 | def next(self): | 198 | def __next__(self): |
1037 | 199 | value = self.consume() | 199 | value = self.consume() |
1038 | 200 | if value is None: | 200 | if value is None: |
1039 | 201 | raise StopIteration | 201 | raise StopIteration |
1040 | diff --git a/lib/lp/services/webapp/tests/test_authorization.py b/lib/lp/services/webapp/tests/test_authorization.py | |||
1041 | index 5f5db72..8062473 100644 | |||
1042 | --- a/lib/lp/services/webapp/tests/test_authorization.py | |||
1043 | +++ b/lib/lp/services/webapp/tests/test_authorization.py | |||
1044 | @@ -489,7 +489,7 @@ class LoneObject(LaunchpadContainer): | |||
1045 | 489 | 489 | ||
1046 | 490 | def __init__(self): | 490 | def __init__(self): |
1047 | 491 | super(LoneObject, self).__init__(self) | 491 | super(LoneObject, self).__init__(self) |
1049 | 492 | self.id = LoneObject._id_counter.next() | 492 | self.id = next(LoneObject._id_counter) |
1050 | 493 | 493 | ||
1051 | 494 | def getParentContainers(self): | 494 | def getParentContainers(self): |
1052 | 495 | return [] | 495 | return [] |
1053 | diff --git a/lib/lp/testing/__init__.py b/lib/lp/testing/__init__.py | |||
1054 | index 85ffd79..20a50d9 100644 | |||
1055 | --- a/lib/lp/testing/__init__.py | |||
1056 | +++ b/lib/lp/testing/__init__.py | |||
1057 | @@ -1320,11 +1320,11 @@ def time_counter(origin=None, delta=timedelta(seconds=5)): | |||
1058 | 1320 | by the delta. | 1320 | by the delta. |
1059 | 1321 | 1321 | ||
1060 | 1322 | >>> now = time_counter(datetime(2007, 12, 1), timedelta(days=1)) | 1322 | >>> now = time_counter(datetime(2007, 12, 1), timedelta(days=1)) |
1062 | 1323 | >>> now.next() | 1323 | >>> next(now) |
1063 | 1324 | datetime.datetime(2007, 12, 1, 0, 0) | 1324 | datetime.datetime(2007, 12, 1, 0, 0) |
1065 | 1325 | >>> now.next() | 1325 | >>> next(now) |
1066 | 1326 | datetime.datetime(2007, 12, 2, 0, 0) | 1326 | datetime.datetime(2007, 12, 2, 0, 0) |
1068 | 1327 | >>> now.next() | 1327 | >>> next(now) |
1069 | 1328 | datetime.datetime(2007, 12, 3, 0, 0) | 1328 | datetime.datetime(2007, 12, 3, 0, 0) |
1070 | 1329 | """ | 1329 | """ |
1071 | 1330 | if origin is None: | 1330 | if origin is None: |
1072 | diff --git a/lib/lp/testing/factory.py b/lib/lp/testing/factory.py | |||
1073 | index 6c0492f..61efb37 100644 | |||
1074 | --- a/lib/lp/testing/factory.py | |||
1075 | +++ b/lib/lp/testing/factory.py | |||
1076 | @@ -440,7 +440,7 @@ class ObjectFactory: | |||
1077 | 440 | For each thread, this will be a series of increasing numbers, but the | 440 | For each thread, this will be a series of increasing numbers, but the |
1078 | 441 | starting point will be unique per thread. | 441 | starting point will be unique per thread. |
1079 | 442 | """ | 442 | """ |
1081 | 443 | return ObjectFactory._unique_int_counter.next() | 443 | return next(ObjectFactory._unique_int_counter) |
1082 | 444 | 444 | ||
1083 | 445 | def getUniqueHexString(self, digits=None): | 445 | def getUniqueHexString(self, digits=None): |
1084 | 446 | """Return a unique hexadecimal string. | 446 | """Return a unique hexadecimal string. |
1085 | @@ -1740,7 +1740,7 @@ class BareLaunchpadObjectFactory(ObjectFactory): | |||
1086 | 1740 | revision = revision_set.new( | 1740 | revision = revision_set.new( |
1087 | 1741 | revision_id=self.getUniqueString('revision-id'), | 1741 | revision_id=self.getUniqueString('revision-id'), |
1088 | 1742 | log_body=self.getUniqueString('log-body'), | 1742 | log_body=self.getUniqueString('log-body'), |
1090 | 1743 | revision_date=date_generator.next(), | 1743 | revision_date=next(date_generator), |
1091 | 1744 | revision_author=author, | 1744 | revision_author=author, |
1092 | 1745 | parent_ids=parent_ids, | 1745 | parent_ids=parent_ids, |
1093 | 1746 | properties={}) | 1746 | properties={}) |
1094 | @@ -2545,7 +2545,7 @@ class BareLaunchpadObjectFactory(ObjectFactory): | |||
1095 | 2545 | # If a date_started is specified, then base the finish time | 2545 | # If a date_started is specified, then base the finish time |
1096 | 2546 | # on that. | 2546 | # on that. |
1097 | 2547 | if date_started is None: | 2547 | if date_started is None: |
1099 | 2548 | date_finished = time_counter().next() | 2548 | date_finished = next(time_counter()) |
1100 | 2549 | else: | 2549 | else: |
1101 | 2550 | date_finished = date_started + timedelta(hours=4) | 2550 | date_finished = date_started + timedelta(hours=4) |
1102 | 2551 | if date_started is None: | 2551 | if date_started is None: |
1103 | diff --git a/lib/lp/translations/browser/tests/test_translationmessage_view.py b/lib/lp/translations/browser/tests/test_translationmessage_view.py | |||
1104 | index c196dc5..e7d7f88 100644 | |||
1105 | --- a/lib/lp/translations/browser/tests/test_translationmessage_view.py | |||
1106 | +++ b/lib/lp/translations/browser/tests/test_translationmessage_view.py | |||
1107 | @@ -9,6 +9,7 @@ from datetime import ( | |||
1108 | 9 | datetime, | 9 | datetime, |
1109 | 10 | timedelta, | 10 | timedelta, |
1110 | 11 | ) | 11 | ) |
1111 | 12 | from functools import partial | ||
1112 | 12 | 13 | ||
1113 | 13 | import pytz | 14 | import pytz |
1114 | 14 | from zope.component import getUtility | 15 | from zope.component import getUtility |
1115 | @@ -58,7 +59,7 @@ class TestCurrentTranslationMessage_can_dismiss(TestCaseWithFactory): | |||
1116 | 58 | self.pofile = self.factory.makePOFile(potemplate=self.potemplate) | 59 | self.pofile = self.factory.makePOFile(potemplate=self.potemplate) |
1117 | 59 | self.potmsgset = self.factory.makePOTMsgSet(self.potemplate) | 60 | self.potmsgset = self.factory.makePOTMsgSet(self.potemplate) |
1118 | 60 | self.view = None | 61 | self.view = None |
1120 | 61 | self.now = self._gen_now().next | 62 | self.now = partial(next, self._gen_now()) |
1121 | 62 | 63 | ||
1122 | 63 | def _createView(self, message): | 64 | def _createView(self, message): |
1123 | 64 | self.view = CurrentTranslationMessageView( | 65 | self.view = CurrentTranslationMessageView( |
1124 | diff --git a/lib/lp/translations/tests/test_potmsgset.py b/lib/lp/translations/tests/test_potmsgset.py | |||
1125 | index c5aaae5..9ea5cc6 100644 | |||
1126 | --- a/lib/lp/translations/tests/test_potmsgset.py | |||
1127 | +++ b/lib/lp/translations/tests/test_potmsgset.py | |||
1128 | @@ -7,6 +7,7 @@ from datetime import ( | |||
1129 | 7 | datetime, | 7 | datetime, |
1130 | 8 | timedelta, | 8 | timedelta, |
1131 | 9 | ) | 9 | ) |
1132 | 10 | from functools import partial | ||
1133 | 10 | 11 | ||
1134 | 11 | import pytz | 12 | import pytz |
1135 | 12 | import transaction | 13 | import transaction |
1136 | @@ -648,7 +649,7 @@ class TestPOTMsgSetSuggestions(TestCaseWithFactory): | |||
1137 | 648 | # Create a product with all the boilerplate objects to be able to | 649 | # Create a product with all the boilerplate objects to be able to |
1138 | 649 | # create TranslationMessage objects. | 650 | # create TranslationMessage objects. |
1139 | 650 | super(TestPOTMsgSetSuggestions, self).setUp('carlos@canonical.com') | 651 | super(TestPOTMsgSetSuggestions, self).setUp('carlos@canonical.com') |
1141 | 651 | self.now = self.gen_now().next | 652 | self.now = partial(next, self.gen_now()) |
1142 | 652 | self.foo = self.factory.makeProduct( | 653 | self.foo = self.factory.makeProduct( |
1143 | 653 | translations_usage=ServiceUsage.LAUNCHPAD) | 654 | translations_usage=ServiceUsage.LAUNCHPAD) |
1144 | 654 | self.foo_main = self.factory.makeProductSeries( | 655 | self.foo_main = self.factory.makeProductSeries( |
1145 | @@ -846,7 +847,7 @@ class TestPOTMsgSetResetTranslation(TestCaseWithFactory): | |||
1146 | 846 | # create TranslationMessage objects. | 847 | # create TranslationMessage objects. |
1147 | 847 | super(TestPOTMsgSetResetTranslation, self).setUp( | 848 | super(TestPOTMsgSetResetTranslation, self).setUp( |
1148 | 848 | 'carlos@canonical.com') | 849 | 'carlos@canonical.com') |
1150 | 849 | self.now = self.gen_now().next | 850 | self.now = partial(next, self.gen_now()) |
1151 | 850 | self.foo = self.factory.makeProduct( | 851 | self.foo = self.factory.makeProduct( |
1152 | 851 | translations_usage=ServiceUsage.LAUNCHPAD) | 852 | translations_usage=ServiceUsage.LAUNCHPAD) |
1153 | 852 | self.foo_main = self.factory.makeProductSeries( | 853 | self.foo_main = self.factory.makeProductSeries( |
Added a simple comment, but nothing that blocks this MP.