Merge lp:~cjwatson/launchpad/code-tests-future-imports into lp:launchpad

Proposed by Colin Watson
Status: Merged
Merged at revision: 18483
Proposed branch: lp:~cjwatson/launchpad/code-tests-future-imports
Merge into: lp:launchpad
Prerequisite: lp:~cjwatson/launchpad/code-bzr-tests-future-imports
Diff against target: 1225 lines (+209/-125)
45 files modified
lib/lp/code/doc/codeimport-job.txt (+1/-2)
lib/lp/code/model/tests/test_branchcloud.py (+3/-1)
lib/lp/code/model/tests/test_branchcollection.py (+2/-0)
lib/lp/code/model/tests/test_branchlistingqueryoptimiser.py (+3/-1)
lib/lp/code/model/tests/test_branchlookup.py (+5/-3)
lib/lp/code/model/tests/test_branchmergeproposal.py (+23/-22)
lib/lp/code/model/tests/test_branchmergeproposaljobs.py (+7/-5)
lib/lp/code/model/tests/test_branchnamespace.py (+3/-1)
lib/lp/code/model/tests/test_branchpuller.py (+3/-1)
lib/lp/code/model/tests/test_branchset.py (+3/-1)
lib/lp/code/model/tests/test_branchsubscription.py (+3/-2)
lib/lp/code/model/tests/test_branchtarget.py (+3/-1)
lib/lp/code/model/tests/test_branchvisibility.py (+3/-1)
lib/lp/code/model/tests/test_codeimport.py (+14/-12)
lib/lp/code/model/tests/test_codeimportjob.py (+11/-9)
lib/lp/code/model/tests/test_codeimportmachine.py (+3/-1)
lib/lp/code/model/tests/test_codeimportresult.py (+3/-1)
lib/lp/code/model/tests/test_codereviewcomment.py (+3/-1)
lib/lp/code/model/tests/test_codereviewinlinecomment.py (+3/-1)
lib/lp/code/model/tests/test_codereviewkarma.py (+3/-1)
lib/lp/code/model/tests/test_codereviewvote.py (+3/-1)
lib/lp/code/model/tests/test_hasbranches.py (+3/-1)
lib/lp/code/model/tests/test_hasmergeproposals.py (+3/-1)
lib/lp/code/model/tests/test_hasrecipes.py (+4/-2)
lib/lp/code/model/tests/test_linkedbranch.py (+3/-1)
lib/lp/code/model/tests/test_recipebuilder.py (+15/-13)
lib/lp/code/model/tests/test_revisionauthor.py (+3/-1)
lib/lp/code/model/tests/test_revisioncache.py (+3/-1)
lib/lp/code/model/tests/test_seriessourcepackagebranch.py (+3/-1)
lib/lp/code/model/tests/test_sourcepackagerecipe.py (+9/-7)
lib/lp/code/model/tests/test_sourcepackagerecipebuild.py (+11/-9)
lib/lp/code/tests/branch_helper.py (+3/-1)
lib/lp/code/tests/codeimporthelpers.py (+3/-1)
lib/lp/code/tests/helpers.py (+5/-3)
lib/lp/code/tests/test_branch.py (+3/-1)
lib/lp/code/tests/test_branch_access_policy_triggers.py (+3/-1)
lib/lp/code/tests/test_branch_webservice.py (+3/-1)
lib/lp/code/tests/test_branchmergeproposal.py (+2/-1)
lib/lp/code/tests/test_branchurifield.py (+7/-5)
lib/lp/code/tests/test_doc.py (+3/-1)
lib/lp/code/tests/test_helpers.py (+3/-1)
lib/lp/code/tests/test_project.py (+3/-1)
lib/lp/code/tests/test_publisher.py (+3/-1)
lib/lp/code/tests/test_seriessourcepackagebranch.py (+3/-1)
lib/lp/code/tests/test_yuitests.py (+3/-1)
To merge this branch: bzr merge lp:~cjwatson/launchpad/code-tests-future-imports
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+331764@code.launchpad.net

Commit message

Convert remaining tests under lp.code.model.tests and lp.code.tests to Launchpad's preferred __future__ imports.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/code/doc/codeimport-job.txt'
2--- lib/lp/code/doc/codeimport-job.txt 2012-12-26 01:32:19 +0000
3+++ lib/lp/code/doc/codeimport-job.txt 2017-10-04 03:01:13 +0000
4@@ -256,5 +256,4 @@
5 No code import events are generated by this method.
6
7 >>> new_events.summary()
8- ''
9-
10+ u''
11
12=== modified file 'lib/lp/code/model/tests/test_branchcloud.py'
13--- lib/lp/code/model/tests/test_branchcloud.py 2012-01-01 02:58:52 +0000
14+++ lib/lp/code/model/tests/test_branchcloud.py 2017-10-04 03:01:13 +0000
15@@ -1,8 +1,10 @@
16-# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
17+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
18 # GNU Affero General Public License version 3 (see the file LICENSE).
19
20 """Tests for IBranchCloud provider."""
21
22+from __future__ import absolute_import, print_function, unicode_literals
23+
24 __metaclass__ = type
25
26 from datetime import (
27
28=== modified file 'lib/lp/code/model/tests/test_branchcollection.py'
29--- lib/lp/code/model/tests/test_branchcollection.py 2017-06-15 01:02:11 +0000
30+++ lib/lp/code/model/tests/test_branchcollection.py 2017-10-04 03:01:13 +0000
31@@ -3,6 +3,8 @@
32
33 """Tests for branch collections."""
34
35+from __future__ import absolute_import, print_function, unicode_literals
36+
37 __metaclass__ = type
38
39 from datetime import (
40
41=== modified file 'lib/lp/code/model/tests/test_branchlistingqueryoptimiser.py'
42--- lib/lp/code/model/tests/test_branchlistingqueryoptimiser.py 2014-06-10 16:13:03 +0000
43+++ lib/lp/code/model/tests/test_branchlistingqueryoptimiser.py 2017-10-04 03:01:13 +0000
44@@ -1,8 +1,10 @@
45-# Copyright 2009-2014 Canonical Ltd. This software is licensed under the
46+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
47 # GNU Affero General Public License version 3 (see the file LICENSE).
48
49 """Tests for the branch listing query optimiser."""
50
51+from __future__ import absolute_import, print_function, unicode_literals
52+
53 __metaclass__ = type
54
55 from storm.store import Store
56
57=== modified file 'lib/lp/code/model/tests/test_branchlookup.py'
58--- lib/lp/code/model/tests/test_branchlookup.py 2015-09-29 15:00:10 +0000
59+++ lib/lp/code/model/tests/test_branchlookup.py 2017-10-04 03:01:13 +0000
60@@ -1,8 +1,10 @@
61-# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
62+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
63 # GNU Affero General Public License version 3 (see the file LICENSE).
64
65 """Tests for the IBranchLookup implementation."""
66
67+from __future__ import absolute_import, print_function, unicode_literals
68+
69 __metaclass__ = type
70
71 from lazr.uri import URI
72@@ -746,7 +748,7 @@
73 series = self.factory.makeProductSeries(branch=branch)
74 result = self.branch_lookup.getByLPPath(
75 '%s/%s/other/bits' % (series.product.name, series.name))
76- self.assertEqual((branch, u'other/bits'), result)
77+ self.assertEqual((branch, 'other/bits'), result)
78
79 def test_too_long_sourcepackage(self):
80 package = self.factory.makeSourcePackage()
81@@ -757,7 +759,7 @@
82 package.distribution.owner)
83 result = self.branch_lookup.getByLPPath(
84 '%s/other/bits' % package.path)
85- self.assertEqual((branch, u'other/bits'), result)
86+ self.assertEqual((branch, 'other/bits'), result)
87
88
89 class PerformLookupTestCase(TestCaseWithFactory):
90
91=== modified file 'lib/lp/code/model/tests/test_branchmergeproposal.py'
92--- lib/lp/code/model/tests/test_branchmergeproposal.py 2017-05-23 08:24:55 +0000
93+++ lib/lp/code/model/tests/test_branchmergeproposal.py 2017-10-04 03:01:13 +0000
94@@ -3,6 +3,8 @@
95
96 """Tests for BranchMergeProposals."""
97
98+from __future__ import absolute_import, print_function, unicode_literals
99+
100 __metaclass__ = type
101
102 from datetime import (
103@@ -641,7 +643,7 @@
104 self.mp_one = self.factory.makeBranchMergeProposal()
105 self.mp_two = self.factory.makeBranchMergeProposal()
106 self.preview_diff = self.mp_one.updatePreviewDiff(
107- 'Some diff', u"source_id", u"target_id")
108+ 'Some diff', "source_id", "target_id")
109 transaction.commit()
110
111 def test_getPreviewDiff(self):
112@@ -1500,22 +1502,22 @@
113 bmp = self._makeBranchMergeProposal()
114 self.hosting_fixture.getLog.result = [
115 {
116- u"sha1": bmp.source_git_commit_sha1,
117- u"message": u"Commit 1\n\nLP: #%d" % bugs[0].id,
118+ "sha1": bmp.source_git_commit_sha1,
119+ "message": "Commit 1\n\nLP: #%d" % bugs[0].id,
120 },
121 {
122- u"sha1": unicode(hashlib.sha1("1").hexdigest()),
123+ "sha1": unicode(hashlib.sha1("1").hexdigest()),
124 # Will not be matched.
125- u"message": u"Commit 2; see LP #%d" % bugs[1].id,
126- },
127- {
128- u"sha1": unicode(hashlib.sha1("2").hexdigest()),
129- u"message": u"Commit 3; LP: #%d" % bugs[2].id,
130- },
131- {
132- u"sha1": unicode(hashlib.sha1("3").hexdigest()),
133+ "message": "Commit 2; see LP #%d" % bugs[1].id,
134+ },
135+ {
136+ "sha1": unicode(hashlib.sha1("2").hexdigest()),
137+ "message": "Commit 3; LP: #%d" % bugs[2].id,
138+ },
139+ {
140+ "sha1": unicode(hashlib.sha1("3").hexdigest()),
141 # Non-existent bug ID will not be returned.
142- u"message": u"Non-existent bug; LP: #%d" % (bugs[2].id + 100),
143+ "message": "Non-existent bug; LP: #%d" % (bugs[2].id + 100),
144 },
145 ]
146 related_bugs = bmp._fetchRelatedBugIDsFromSource()
147@@ -1533,8 +1535,8 @@
148 """Set up a fake log response referring to the given bugs."""
149 self.hosting_fixture.getLog.result = [
150 {
151- u"sha1": unicode(hashlib.sha1(str(i)).hexdigest()),
152- u"message": u"LP: #%d" % bug.id,
153+ "sha1": unicode(hashlib.sha1(str(i)).hexdigest()),
154+ "message": "LP: #%d" % bug.id,
155 }
156 for i, bug in enumerate(bugs)]
157 self.hosting_fixture.memcache_fixture.clear()
158@@ -1595,15 +1597,15 @@
159 bmp.updateRelatedBugsFromSource()
160 self.assertEqual([bug], bmp.bugs)
161 matches_expected_xref = MatchesDict(
162- {(u"bug", unicode(bug.id)): ContainsDict({"metadata": Is(None)})})
163+ {("bug", unicode(bug.id)): ContainsDict({"metadata": Is(None)})})
164 self.assertThat(
165 getUtility(IXRefSet).findFrom(
166- (u"merge_proposal", unicode(bmp.id)), types=[u"bug"]),
167+ ("merge_proposal", unicode(bmp.id)), types=["bug"]),
168 matches_expected_xref)
169 self._setUpLog([bug])
170 self.assertThat(
171 getUtility(IXRefSet).findFrom(
172- (u"merge_proposal", unicode(bmp.id)), types=[u"bug"]),
173+ ("merge_proposal", unicode(bmp.id)), types=["bug"]),
174 matches_expected_xref)
175
176 def test_updateRelatedBugsFromSource_honours_limit(self):
177@@ -2101,8 +2103,7 @@
178 " from lp.services.config import config\n")
179 diff_stat = {'sample': (1, 1)}
180 login_person(merge_proposal.registrant)
181- merge_proposal.updatePreviewDiff(
182- diff_text, u"source_id", u"target_id")
183+ merge_proposal.updatePreviewDiff(diff_text, "source_id", "target_id")
184 # Have to commit the transaction to make the Librarian file
185 # available.
186 transaction.commit()
187@@ -2120,7 +2121,7 @@
188 merge_proposal = self.factory.makeBranchMergeProposal()
189 login_person(merge_proposal.registrant)
190 diff_bytes = ''.join(unified_diff('', 'random text'))
191- merge_proposal.updatePreviewDiff(diff_bytes, u"a", u"b")
192+ merge_proposal.updatePreviewDiff(diff_bytes, "a", "b")
193 transaction.commit()
194 # Extract the primary key ids for the preview diff and the diff to
195 # show that we are not reusing the objects.
196@@ -2607,7 +2608,7 @@
197 review_comment = ws_bmp.createComment(
198 subject='Testing!',
199 previewdiff_id=previewdiff.id,
200- inline_comments={u'2': u'foo'})
201+ inline_comments={'2': 'foo'})
202 transaction.commit()
203
204 # Retrieving published inline comments requires only lp.View
205
206=== modified file 'lib/lp/code/model/tests/test_branchmergeproposaljobs.py'
207--- lib/lp/code/model/tests/test_branchmergeproposaljobs.py 2017-06-29 18:05:23 +0000
208+++ lib/lp/code/model/tests/test_branchmergeproposaljobs.py 2017-10-04 03:01:13 +0000
209@@ -3,6 +3,8 @@
210
211 """Tests for branch merge proposal jobs."""
212
213+from __future__ import absolute_import, print_function, unicode_literals
214+
215 __metaclass__ = type
216
217 from datetime import (
218@@ -275,11 +277,11 @@
219 committer = self.factory.makePerson()
220 self.hosting_fixture.getLog.result = [
221 {
222- u"sha1": unicode(hashlib.sha1("tip").hexdigest()),
223- u"message": u"Fix upside-down messages\n\nLP: #%d" % bug.id,
224- u"committer": {
225- u"name": committer.display_name,
226- u"email": committer.preferredemail.email,
227+ "sha1": unicode(hashlib.sha1("tip").hexdigest()),
228+ "message": "Fix upside-down messages\n\nLP: #%d" % bug.id,
229+ "committer": {
230+ "name": committer.display_name,
231+ "email": committer.preferredemail.email,
232 },
233 },
234 ]
235
236=== modified file 'lib/lp/code/model/tests/test_branchnamespace.py'
237--- lib/lp/code/model/tests/test_branchnamespace.py 2016-09-30 13:27:27 +0000
238+++ lib/lp/code/model/tests/test_branchnamespace.py 2017-10-04 03:01:13 +0000
239@@ -1,8 +1,10 @@
240-# Copyright 2009-2016 Canonical Ltd. This software is licensed under the
241+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
242 # GNU Affero General Public License version 3 (see the file LICENSE).
243
244 """Tests for `IBranchNamespace` implementations."""
245
246+from __future__ import absolute_import, print_function, unicode_literals
247+
248 __metaclass__ = type
249
250 from zope.component import getUtility
251
252=== modified file 'lib/lp/code/model/tests/test_branchpuller.py'
253--- lib/lp/code/model/tests/test_branchpuller.py 2012-09-18 18:36:09 +0000
254+++ lib/lp/code/model/tests/test_branchpuller.py 2017-10-04 03:01:13 +0000
255@@ -1,8 +1,10 @@
256-# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
257+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
258 # GNU Affero General Public License version 3 (see the file LICENSE).
259
260 """Tests for the branch puller model code."""
261
262+from __future__ import absolute_import, print_function, unicode_literals
263+
264 __metaclass__ = type
265
266 from datetime import (
267
268=== modified file 'lib/lp/code/model/tests/test_branchset.py'
269--- lib/lp/code/model/tests/test_branchset.py 2015-09-30 00:38:30 +0000
270+++ lib/lp/code/model/tests/test_branchset.py 2017-10-04 03:01:13 +0000
271@@ -1,8 +1,10 @@
272-# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
273+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
274 # GNU Affero General Public License version 3 (see the file LICENSE).
275
276 """Tests for BranchSet."""
277
278+from __future__ import absolute_import, print_function, unicode_literals
279+
280 __metaclass__ = type
281
282 from testtools.matchers import LessThan
283
284=== modified file 'lib/lp/code/model/tests/test_branchsubscription.py'
285--- lib/lp/code/model/tests/test_branchsubscription.py 2015-04-15 18:21:48 +0000
286+++ lib/lp/code/model/tests/test_branchsubscription.py 2017-10-04 03:01:13 +0000
287@@ -1,11 +1,12 @@
288-# Copyright 2010-2015 Canonical Ltd. This software is licensed under the
289+# Copyright 2010-2017 Canonical Ltd. This software is licensed under the
290 # GNU Affero General Public License version 3 (see the file LICENSE).
291
292 """Tests for the BranchSubscription model object."""
293
294+from __future__ import absolute_import, print_function, unicode_literals
295+
296 __metaclass__ = type
297
298-
299 from zope.component import getUtility
300
301 from lp.app.enums import InformationType
302
303=== modified file 'lib/lp/code/model/tests/test_branchtarget.py'
304--- lib/lp/code/model/tests/test_branchtarget.py 2016-10-03 10:54:48 +0000
305+++ lib/lp/code/model/tests/test_branchtarget.py 2017-10-04 03:01:13 +0000
306@@ -1,8 +1,10 @@
307-# Copyright 2009-2016 Canonical Ltd. This software is licensed under the
308+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
309 # GNU Affero General Public License version 3 (see the file LICENSE).
310
311 """Tests for branch contexts."""
312
313+from __future__ import absolute_import, print_function, unicode_literals
314+
315 __metaclass__ = type
316
317 from zope.security.proxy import removeSecurityProxy
318
319=== modified file 'lib/lp/code/model/tests/test_branchvisibility.py'
320--- lib/lp/code/model/tests/test_branchvisibility.py 2016-01-26 15:47:37 +0000
321+++ lib/lp/code/model/tests/test_branchvisibility.py 2017-10-04 03:01:13 +0000
322@@ -1,4 +1,4 @@
323-# Copyright 2011-2012 Canonical Ltd. This software is licensed under the
324+# Copyright 2011-2017 Canonical Ltd. This software is licensed under the
325 # GNU Affero General Public License version 3 (see the file LICENSE).
326
327 """Tests for visibility of branches.
328@@ -10,6 +10,8 @@
329 are only visible to the owner of the branch, and the subscribers.
330 """
331
332+from __future__ import absolute_import, print_function, unicode_literals
333+
334 __metaclass__ = type
335
336 from zope.component import (
337
338=== modified file 'lib/lp/code/model/tests/test_codeimport.py'
339--- lib/lp/code/model/tests/test_codeimport.py 2016-10-15 01:59:02 +0000
340+++ lib/lp/code/model/tests/test_codeimport.py 2017-10-04 03:01:13 +0000
341@@ -1,8 +1,10 @@
342-# Copyright 2009-2016 Canonical Ltd. This software is licensed under the
343+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
344 # GNU Affero General Public License version 3 (see the file LICENSE).
345
346 """Unit tests for methods of CodeImport and CodeImportSet."""
347
348+from __future__ import absolute_import, print_function, unicode_literals
349+
350 from datetime import (
351 datetime,
352 timedelta,
353@@ -95,7 +97,7 @@
354 CodeImportSet().new,
355 registrant=self.factory.makePerson(),
356 context=self.factory.makeProduct(),
357- branch_name=u'imported',
358+ branch_name='imported',
359 rcs_type=RevisionControlSystems.BZR_SVN,
360 target_rcs_type=self.target_rcs_type,
361 url=self.factory.getUniqueURL(scheme="svn"))
362@@ -115,7 +117,7 @@
363 CodeImportSet().new,
364 registrant=self.factory.makePerson(),
365 context=self.factory.makeProduct(),
366- branch_name=u'imported',
367+ branch_name='imported',
368 rcs_type=RevisionControlSystems.BZR_SVN,
369 target_rcs_type=self.target_rcs_type,
370 url=self.factory.getUniqueURL(),
371@@ -136,11 +138,11 @@
372 CodeImportSet().new,
373 registrant=self.factory.makePerson(),
374 context=self.factory.makeProduct(),
375- branch_name=u'imported',
376+ branch_name='imported',
377 rcs_type=RevisionControlSystems.CVS,
378 target_rcs_type=self.target_rcs_type,
379 cvs_root=self.factory.getUniqueURL(),
380- cvs_module=u'module',
381+ cvs_module='module',
382 review_status=None)
383 if self.supports_source_cvs:
384 code_import = create_func()
385@@ -157,7 +159,7 @@
386 code_import = CodeImportSet().new(
387 registrant=self.factory.makePerson(),
388 context=self.factory.makeProduct(),
389- branch_name=u'imported',
390+ branch_name='imported',
391 rcs_type=RevisionControlSystems.GIT,
392 target_rcs_type=self.target_rcs_type,
393 url=self.factory.getUniqueURL(scheme="git"),
394@@ -178,7 +180,7 @@
395 code_import = CodeImportSet().new(
396 registrant=self.factory.makePerson(),
397 context=self.factory.makeProduct(),
398- branch_name=u'imported',
399+ branch_name='imported',
400 rcs_type=RevisionControlSystems.GIT,
401 target_rcs_type=self.target_rcs_type,
402 url=self.factory.getUniqueURL(),
403@@ -200,7 +202,7 @@
404 CodeImportSet().new,
405 registrant=self.factory.makePerson(),
406 context=self.factory.makeProduct(),
407- branch_name=u'mirrored',
408+ branch_name='mirrored',
409 rcs_type=RevisionControlSystems.BZR,
410 target_rcs_type=self.target_rcs_type,
411 url=self.factory.getUniqueURL(),
412@@ -221,7 +223,7 @@
413 self.assertRaises(AssertionError, CodeImportSet().new,
414 registrant=registrant,
415 context=registrant,
416- branch_name=u'imported',
417+ branch_name='imported',
418 rcs_type=RevisionControlSystems.GIT,
419 target_rcs_type=self.target_rcs_type,
420 url=self.factory.getUniqueURL(),
421@@ -238,7 +240,7 @@
422 code_import = CodeImportSet().new(
423 registrant=registrant,
424 context=context,
425- branch_name=u'imported',
426+ branch_name='imported',
427 rcs_type=RevisionControlSystems.GIT,
428 target_rcs_type=self.target_rcs_type,
429 url=self.factory.getUniqueURL(),
430@@ -268,7 +270,7 @@
431 code_import = CodeImportSet().new(
432 registrant=registrant,
433 context=context,
434- branch_name=u'imported',
435+ branch_name='imported',
436 rcs_type=RevisionControlSystems.GIT,
437 target_rcs_type=self.target_rcs_type,
438 url=self.factory.getUniqueURL(),
439@@ -303,7 +305,7 @@
440 CodeImportSet().new,
441 registrant=registrant,
442 context=context,
443- branch_name=u'imported',
444+ branch_name='imported',
445 rcs_type=RevisionControlSystems.GIT,
446 target_rcs_type=self.target_rcs_type,
447 url=self.factory.getUniqueURL(),
448
449=== modified file 'lib/lp/code/model/tests/test_codeimportjob.py'
450--- lib/lp/code/model/tests/test_codeimportjob.py 2016-12-31 05:02:35 +0000
451+++ lib/lp/code/model/tests/test_codeimportjob.py 2017-10-04 03:01:13 +0000
452@@ -1,8 +1,10 @@
453-# Copyright 2009-2016 Canonical Ltd. This software is licensed under the
454+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
455 # GNU Affero General Public License version 3 (see the file LICENSE).
456
457 """Unit tests for CodeImportJob and CodeImportJobWorkflow."""
458
459+from __future__ import absolute_import, print_function, unicode_literals
460+
461 __metaclass__ = type
462
463 __all__ = [
464@@ -127,7 +129,7 @@
465 if state == CodeImportJobState.RUNNING:
466 getUtility(ICodeImportJobWorkflow).startJob(job, self.machine)
467 naked_job = removeSecurityProxy(job)
468- naked_job.date_due = UTC_NOW + u'%d days' % date_due_delta
469+ naked_job.date_due = UTC_NOW + '%d days' % date_due_delta
470 naked_job.requesting_user = requesting_user
471 return job
472
473@@ -235,7 +237,7 @@
474 def makeJobWithHeartbeatInPast(self, seconds_in_past):
475 code_import = make_running_import(factory=self.factory)
476 naked_job = removeSecurityProxy(code_import.import_job)
477- naked_job.heartbeat = UTC_NOW + u'%d seconds' % -seconds_in_past
478+ naked_job.heartbeat = UTC_NOW + '%d seconds' % -seconds_in_past
479 return code_import.import_job
480
481 def assertReclaimableJobs(self, jobs):
482@@ -701,7 +703,7 @@
483 "The CodeImportJob associated with %s is "
484 "PENDING." % code_import.branch.unique_name,
485 getUtility(ICodeImportJobWorkflow).updateHeartbeat,
486- job, u'')
487+ job, '')
488
489 def test_updateHeartboat(self):
490 code_import = self.factory.makeCodeImport()
491@@ -712,9 +714,9 @@
492 # Set heartbeat to something wrong so that we can prove that it was
493 # changed.
494 removeSecurityProxy(job).heartbeat = None
495- workflow.updateHeartbeat(job, u'some interesting log output')
496+ workflow.updateHeartbeat(job, 'some interesting log output')
497 self.assertSqlAttributeEqualsDate(job, 'heartbeat', UTC_NOW)
498- self.assertEqual(u'some interesting log output', job.logtail)
499+ self.assertEqual('some interesting log output', job.logtail)
500
501
502 class TestCodeImportJobWorkflowFinishJob(TestCaseWithFactory,
503@@ -1126,7 +1128,7 @@
504 self.requestJobByUserWithDisplayName(code_import_id, "New User")
505 user_browser.getControl('Import Now').click()
506 self.assertEqual(
507- [u'The import has already been requested by New User.'],
508+ ['The import has already been requested by New User.'],
509 get_feedback_messages(user_browser.contents))
510
511 def test_pressButtonJobDeleted(self):
512@@ -1137,7 +1139,7 @@
513 self.deleteJob(code_import_id)
514 user_browser.getControl('Import Now').click()
515 self.assertEqual(
516- [u'This import is no longer being updated automatically.'],
517+ ['This import is no longer being updated automatically.'],
518 get_feedback_messages(user_browser.contents))
519
520 def test_pressButtonJobStarted(self):
521@@ -1147,7 +1149,7 @@
522 self.startJob(code_import_id)
523 user_browser.getControl('Import Now').click()
524 self.assertEqual(
525- [u'The import is already running.'],
526+ ['The import is already running.'],
527 get_feedback_messages(user_browser.contents))
528
529
530
531=== modified file 'lib/lp/code/model/tests/test_codeimportmachine.py'
532--- lib/lp/code/model/tests/test_codeimportmachine.py 2011-12-30 06:14:56 +0000
533+++ lib/lp/code/model/tests/test_codeimportmachine.py 2017-10-04 03:01:13 +0000
534@@ -1,10 +1,12 @@
535-# Copyright 2009 Canonical Ltd. This software is licensed under the
536+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
537 # GNU Affero General Public License version 3 (see the file LICENSE).
538
539 """Unit tests for methods of CodeImportMachine.
540
541 Other tests are in codeimport-machine.txt."""
542
543+from __future__ import absolute_import, print_function, unicode_literals
544+
545 from zope.component import getUtility
546
547 from lp.code.enums import (
548
549=== modified file 'lib/lp/code/model/tests/test_codeimportresult.py'
550--- lib/lp/code/model/tests/test_codeimportresult.py 2012-01-01 02:58:52 +0000
551+++ lib/lp/code/model/tests/test_codeimportresult.py 2017-10-04 03:01:13 +0000
552@@ -1,8 +1,10 @@
553-# Copyright 2011 Canonical Ltd. This software is licensed under the
554+# Copyright 2011-2017 Canonical Ltd. This software is licensed under the
555 # GNU Affero General Public License version 3 (see the file LICENSE).
556
557 """Tests for CodeImportResult."""
558
559+from __future__ import absolute_import, print_function, unicode_literals
560+
561 __metaclass__ = type
562
563 from datetime import datetime
564
565=== modified file 'lib/lp/code/model/tests/test_codereviewcomment.py'
566--- lib/lp/code/model/tests/test_codereviewcomment.py 2015-10-06 16:09:06 +0000
567+++ lib/lp/code/model/tests/test_codereviewcomment.py 2017-10-04 03:01:13 +0000
568@@ -1,8 +1,10 @@
569-# Copyright 2009-2015 Canonical Ltd. This software is licensed under the
570+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
571 # GNU Affero General Public License version 3 (see the file LICENSE).
572
573 """Unit tests for CodeReviewComment"""
574
575+from __future__ import absolute_import, print_function, unicode_literals
576+
577 from textwrap import dedent
578
579 from lazr.lifecycle.event import ObjectCreatedEvent
580
581=== modified file 'lib/lp/code/model/tests/test_codereviewinlinecomment.py'
582--- lib/lp/code/model/tests/test_codereviewinlinecomment.py 2014-04-04 04:30:48 +0000
583+++ lib/lp/code/model/tests/test_codereviewinlinecomment.py 2017-10-04 03:01:13 +0000
584@@ -1,8 +1,10 @@
585-# Copyright 2013 Canonical Ltd. This software is licensed under the
586+# Copyright 2013-2017 Canonical Ltd. This software is licensed under the
587 # GNU Affero General Public License version 3 (see the file LICENSE).
588
589 """Tests for CodeReviewInlineComment{,Draft,Set}"""
590
591+from __future__ import absolute_import, print_function, unicode_literals
592+
593 __metaclass__ = type
594
595 from datetime import datetime
596
597=== modified file 'lib/lp/code/model/tests/test_codereviewkarma.py'
598--- lib/lp/code/model/tests/test_codereviewkarma.py 2015-10-05 17:03:27 +0000
599+++ lib/lp/code/model/tests/test_codereviewkarma.py 2017-10-04 03:01:13 +0000
600@@ -1,8 +1,10 @@
601-# Copyright 2009-2015 Canonical Ltd. This software is licensed under the
602+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
603 # GNU Affero General Public License version 3 (see the file LICENSE).
604
605 """Tests for karma allocated for code reviews."""
606
607+from __future__ import absolute_import, print_function, unicode_literals
608+
609 __metaclass__ = type
610
611 from lp.code.interfaces.branchmergeproposal import notify_modified
612
613=== modified file 'lib/lp/code/model/tests/test_codereviewvote.py'
614--- lib/lp/code/model/tests/test_codereviewvote.py 2011-12-30 06:14:56 +0000
615+++ lib/lp/code/model/tests/test_codereviewvote.py 2017-10-04 03:01:13 +0000
616@@ -1,6 +1,8 @@
617-# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
618+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
619 # GNU Affero General Public License version 3 (see the file LICENSE).
620
621+from __future__ import absolute_import, print_function, unicode_literals
622+
623 from zope.security.interfaces import Unauthorized
624
625 from lp.code.enums import CodeReviewVote
626
627=== modified file 'lib/lp/code/model/tests/test_hasbranches.py'
628--- lib/lp/code/model/tests/test_hasbranches.py 2016-09-09 12:36:04 +0000
629+++ lib/lp/code/model/tests/test_hasbranches.py 2017-10-04 03:01:13 +0000
630@@ -1,8 +1,10 @@
631-# Copyright 2009-2016 Canonical Ltd. This software is licensed under the
632+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
633 # GNU Affero General Public License version 3 (see the file LICENSE).
634
635 """Tests for classes that implement IHasBranches."""
636
637+from __future__ import absolute_import, print_function, unicode_literals
638+
639 __metaclass__ = type
640
641 from functools import partial
642
643=== modified file 'lib/lp/code/model/tests/test_hasmergeproposals.py'
644--- lib/lp/code/model/tests/test_hasmergeproposals.py 2012-01-01 02:58:52 +0000
645+++ lib/lp/code/model/tests/test_hasmergeproposals.py 2017-10-04 03:01:13 +0000
646@@ -1,8 +1,10 @@
647-# Copyright 2009 Canonical Ltd. This software is licensed under the
648+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
649 # GNU Affero General Public License version 3 (see the file LICENSE).
650
651 """Tests for classes that implement IHasMergeProposals."""
652
653+from __future__ import absolute_import, print_function, unicode_literals
654+
655 __metaclass__ = type
656
657 from zope.interface.verify import verifyObject
658
659=== modified file 'lib/lp/code/model/tests/test_hasrecipes.py'
660--- lib/lp/code/model/tests/test_hasrecipes.py 2016-10-14 16:16:18 +0000
661+++ lib/lp/code/model/tests/test_hasrecipes.py 2017-10-04 03:01:13 +0000
662@@ -1,8 +1,10 @@
663-# Copyright 2010-2016 Canonical Ltd. This software is licensed under the
664+# Copyright 2010-2017 Canonical Ltd. This software is licensed under the
665 # GNU Affero General Public License version 3 (see the file LICENSE).
666
667 """Tests for classes that implement IHasRecipes."""
668
669+from __future__ import absolute_import, print_function, unicode_literals
670+
671 __metaclass__ = type
672
673 from lp.code.interfaces.hasrecipes import IHasRecipes
674@@ -48,7 +50,7 @@
675 # IGitRepository.recipes should provide all the SourcePackageRecipes
676 # attached to that repository.
677 base_ref1, base_ref2 = self.factory.makeGitRefs(
678- paths=[u"refs/heads/ref1", u"refs/heads/ref2"])
679+ paths=["refs/heads/ref1", "refs/heads/ref2"])
680 [other_ref] = self.factory.makeGitRefs()
681 self.factory.makeSourcePackageRecipe(branches=[base_ref1])
682 self.factory.makeSourcePackageRecipe(branches=[base_ref2])
683
684=== modified file 'lib/lp/code/model/tests/test_linkedbranch.py'
685--- lib/lp/code/model/tests/test_linkedbranch.py 2016-12-31 05:02:35 +0000
686+++ lib/lp/code/model/tests/test_linkedbranch.py 2017-10-04 03:01:13 +0000
687@@ -1,8 +1,10 @@
688-# Copyright 2009 Canonical Ltd. This software is licensed under the
689+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
690 # GNU Affero General Public License version 3 (see the file LICENSE).
691
692 """Tests for linked branch implementations."""
693
694+from __future__ import absolute_import, print_function, unicode_literals
695+
696 __metaclass__ = type
697
698 from zope.security.proxy import removeSecurityProxy
699
700=== modified file 'lib/lp/code/model/tests/test_recipebuilder.py'
701--- lib/lp/code/model/tests/test_recipebuilder.py 2017-07-26 13:21:25 +0000
702+++ lib/lp/code/model/tests/test_recipebuilder.py 2017-10-04 03:01:13 +0000
703@@ -3,6 +3,8 @@
704
705 """Test RecipeBuildBehaviour."""
706
707+from __future__ import absolute_import, print_function, unicode_literals
708+
709 __metaclass__ = type
710
711 import os.path
712@@ -88,16 +90,16 @@
713 recipe_owner = recipe_registrant
714 if git:
715 [somebranch] = self.factory.makeGitRefs(
716- owner=recipe_owner, name=u"pkg",
717+ owner=recipe_owner, name="pkg",
718 target=self.factory.makeProduct("someapp"),
719- paths=[u"refs/heads/packaging"])
720+ paths=["refs/heads/packaging"])
721 else:
722 somebranch = self.factory.makeBranch(
723 owner=recipe_owner, name="pkg",
724 product=self.factory.makeProduct("someapp"))
725 recipe = self.factory.makeSourcePackageRecipe(
726- recipe_registrant, recipe_owner, distroseries, u"recept",
727- u"Recipe description", branches=[somebranch])
728+ recipe_registrant, recipe_owner, distroseries, "recept",
729+ "Recipe description", branches=[somebranch])
730 spb = self.factory.makeSourcePackageRecipeBuild(
731 sourcepackage=sourcepackage, archive=archive,
732 recipe=recipe, requester=recipe_owner, distroseries=distroseries)
733@@ -181,10 +183,10 @@
734 self.assertEqual({
735 'archive_private': False,
736 'arch_tag': 'i386',
737- 'author_email': u'requester@ubuntu.com',
738+ 'author_email': 'requester@ubuntu.com',
739 'series': job.build.distroseries.name,
740- 'suite': u'mydistro',
741- 'author_name': u'Joe User',
742+ 'suite': 'mydistro',
743+ 'author_name': 'Joe User',
744 'archive_purpose': 'PPA',
745 'ogrecomponent': 'universe',
746 'recipe_text':
747@@ -274,10 +276,10 @@
748 self.assertEqual({
749 'archive_private': False,
750 'arch_tag': 'i386',
751- 'author_email': u'requester@ubuntu.com',
752+ 'author_email': 'requester@ubuntu.com',
753 'series': job.build.distroseries.name,
754- 'suite': u'mydistro',
755- 'author_name': u'Joe User',
756+ 'suite': 'mydistro',
757+ 'author_name': 'Joe User',
758 'archive_purpose': 'PPA',
759 'ogrecomponent': 'universe',
760 'recipe_text':
761@@ -315,10 +317,10 @@
762 self.assertEqual({
763 'archive_private': False,
764 'arch_tag': 'i386',
765- 'author_email': u'requester@ubuntu.com',
766+ 'author_email': 'requester@ubuntu.com',
767 'series': job.build.distroseries.name,
768- 'suite': u'mydistro',
769- 'author_name': u'Joe User',
770+ 'suite': 'mydistro',
771+ 'author_name': 'Joe User',
772 'archive_purpose': 'PPA',
773 'ogrecomponent': 'universe',
774 'recipe_text':
775
776=== modified file 'lib/lp/code/model/tests/test_revisionauthor.py'
777--- lib/lp/code/model/tests/test_revisionauthor.py 2013-07-04 07:58:00 +0000
778+++ lib/lp/code/model/tests/test_revisionauthor.py 2017-10-04 03:01:13 +0000
779@@ -1,8 +1,10 @@
780-# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
781+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
782 # GNU Affero General Public License version 3 (see the file LICENSE).
783
784 """Tests for RevisionAuthors."""
785
786+from __future__ import absolute_import, print_function, unicode_literals
787+
788 __metaclass__ = type
789
790 import transaction
791
792=== modified file 'lib/lp/code/model/tests/test_revisioncache.py'
793--- lib/lp/code/model/tests/test_revisioncache.py 2015-01-29 14:14:01 +0000
794+++ lib/lp/code/model/tests/test_revisioncache.py 2017-10-04 03:01:13 +0000
795@@ -1,8 +1,10 @@
796-# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
797+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
798 # GNU Affero General Public License version 3 (see the file LICENSE).
799
800 """Tests relating to the revision cache."""
801
802+from __future__ import absolute_import, print_function, unicode_literals
803+
804 __metaclass__ = type
805
806 from datetime import (
807
808=== modified file 'lib/lp/code/model/tests/test_seriessourcepackagebranch.py'
809--- lib/lp/code/model/tests/test_seriessourcepackagebranch.py 2012-01-01 02:58:52 +0000
810+++ lib/lp/code/model/tests/test_seriessourcepackagebranch.py 2017-10-04 03:01:13 +0000
811@@ -1,8 +1,10 @@
812-# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
813+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
814 # GNU Affero General Public License version 3 (see the file LICENSE).
815
816 """Model tests for distro series source package branch links."""
817
818+from __future__ import absolute_import, print_function, unicode_literals
819+
820 __metaclass__ = type
821
822 from lp.code.model.seriessourcepackagebranch import (
823
824=== modified file 'lib/lp/code/model/tests/test_sourcepackagerecipe.py'
825--- lib/lp/code/model/tests/test_sourcepackagerecipe.py 2017-06-16 10:02:47 +0000
826+++ lib/lp/code/model/tests/test_sourcepackagerecipe.py 2017-10-04 03:01:13 +0000
827@@ -3,6 +3,8 @@
828
829 """Tests for the SourcePackageRecipe content type."""
830
831+from __future__ import absolute_import, print_function, unicode_literals
832+
833 __metaclass__ = type
834
835 from datetime import (
836@@ -183,8 +185,8 @@
837 registrant=registrant,
838 owner=self.factory.makeTeam(owner=registrant),
839 distroseries=[self.factory.makeDistroSeries()],
840- name=self.factory.getUniqueString(u'recipe-name'),
841- description=self.factory.getUniqueString(u'recipe-description'),
842+ name=self.factory.getUniqueString('recipe-name'),
843+ description=self.factory.getUniqueString('recipe-description'),
844 recipe=self.factory.makeRecipeText(*branches))
845
846 def test_creation(self):
847@@ -243,7 +245,7 @@
848
849 self.assertFalse(
850 getUtility(ISourcePackageRecipeSource).exists(
851- recipe.owner, u'daily'))
852+ recipe.owner, 'daily'))
853
854 def test_source_implements_interface(self):
855 # The SourcePackageRecipe class implements ISourcePackageRecipeSource.
856@@ -541,7 +543,7 @@
857
858 def test_sourcepackagerecipe_description(self):
859 """Ensure that the SourcePackageRecipe has a proper description."""
860- description = u'The whoozits and whatzits.'
861+ description = 'The whoozits and whatzits.'
862 source_package_recipe = self.makeSourcePackageRecipe(
863 description=description)
864 self.assertEqual(description, source_package_recipe.description)
865@@ -862,8 +864,8 @@
866 registrant = self.factory.makePerson()
867 owner = self.factory.makeTeam(owner=registrant)
868 distroseries = self.factory.makeDistroSeries()
869- name = self.factory.getUniqueString(u'recipe-name')
870- description = self.factory.getUniqueString(u'recipe-description')
871+ name = self.factory.getUniqueString('recipe-name')
872+ description = self.factory.getUniqueString('recipe-description')
873 recipe = getUtility(ISourcePackageRecipeSource).new(
874 registrant=registrant, owner=owner, distroseries=[distroseries],
875 name=name, description=description, recipe=recipe_text)
876@@ -1147,7 +1149,7 @@
877 daily_build_archive=ws_archive)
878 # at the moment, distroseries is not exposed in the API.
879 transaction.commit()
880- db_recipe = owner.getRecipe(name=u'toaster-1')
881+ db_recipe = owner.getRecipe(name='toaster-1')
882 self.assertEqual(set([db_distroseries]), set(db_recipe.distroseries))
883 return recipe, ws_owner, launchpad
884
885
886=== modified file 'lib/lp/code/model/tests/test_sourcepackagerecipebuild.py'
887--- lib/lp/code/model/tests/test_sourcepackagerecipebuild.py 2016-01-12 01:24:06 +0000
888+++ lib/lp/code/model/tests/test_sourcepackagerecipebuild.py 2017-10-04 03:01:13 +0000
889@@ -1,8 +1,10 @@
890-# Copyright 2010-2016 Canonical Ltd. This software is licensed under the
891+# Copyright 2010-2017 Canonical Ltd. This software is licensed under the
892 # GNU Affero General Public License version 3 (see the file LICENSE).
893
894 """Tests for source package builds."""
895
896+from __future__ import absolute_import, print_function, unicode_literals
897+
898 __metaclass__ = type
899
900 from datetime import (
901@@ -247,7 +249,7 @@
902 # that a build is requested for gets logged.
903 owner = self.factory.makePerson(name='eric')
904 self.factory.makeSourcePackageRecipe(
905- owner=owner, name=u'funky-recipe', build_daily=True)
906+ owner=owner, name='funky-recipe', build_daily=True)
907 logger = BufferLogger()
908 SourcePackageRecipeBuild.makeDailyBuilds(logger)
909 self.assertEqual(
910@@ -284,7 +286,7 @@
911 # makeDailyBuilds() won't create a build.
912 owner = self.factory.makePerson(name='eric')
913 recipe = self.factory.makeSourcePackageRecipe(
914- owner=owner, name=u'funky-recipe', build_daily=True,
915+ owner=owner, name='funky-recipe', build_daily=True,
916 is_stale=True)
917 series = list(recipe.distroseries)[0]
918 self.factory.makeSourcePackageRecipeBuild(
919@@ -307,7 +309,7 @@
920 # won't create a build.
921 owner = self.factory.makePerson(name='eric')
922 recipe = self.factory.makeSourcePackageRecipe(
923- owner=owner, name=u'funky-recipe', build_daily=True,
924+ owner=owner, name='funky-recipe', build_daily=True,
925 is_stale=True)
926 archive = self.factory.makeArchive(owner=recipe.owner, name="ppa")
927 removeSecurityProxy(recipe).daily_build_archive = archive
928@@ -327,7 +329,7 @@
929 # insufficient permissions, makeDailyBuilds() won't create a build.
930 owner = self.factory.makePerson(name='eric')
931 recipe = self.factory.makeSourcePackageRecipe(
932- owner=owner, name=u'funky-recipe', build_daily=True,
933+ owner=owner, name='funky-recipe', build_daily=True,
934 is_stale=True)
935 archive = self.factory.makeArchive(name="ppa")
936 removeSecurityProxy(recipe).daily_build_archive = archive
937@@ -485,9 +487,9 @@
938 """
939 person = self.factory.makePerson(name='person')
940 cake = self.factory.makeSourcePackageRecipe(
941- name=u'recipe', owner=person)
942+ name='recipe', owner=person)
943 pantry = self.factory.makeArchive(name='ppa')
944- secret = self.factory.makeDistroSeries(name=u'distroseries')
945+ secret = self.factory.makeDistroSeries(name='distroseries')
946 secret.nominatedarchindep = self.factory.makeDistroArchSeries(
947 distroseries=secret)
948 build = self.factory.makeSourcePackageRecipeBuild(
949@@ -501,9 +503,9 @@
950 """Notify does nothing if recipe has been deleted."""
951 person = self.factory.makePerson(name='person')
952 cake = self.factory.makeSourcePackageRecipe(
953- name=u'recipe', owner=person)
954+ name='recipe', owner=person)
955 pantry = self.factory.makeArchive(name='ppa')
956- secret = self.factory.makeDistroSeries(name=u'distroseries')
957+ secret = self.factory.makeDistroSeries(name='distroseries')
958 secret.nominatedarchindep = self.factory.makeDistroArchSeries(
959 distroseries=secret)
960 build = self.factory.makeSourcePackageRecipeBuild(
961
962=== modified file 'lib/lp/code/tests/branch_helper.py'
963--- lib/lp/code/tests/branch_helper.py 2011-12-08 21:15:07 +0000
964+++ lib/lp/code/tests/branch_helper.py 2017-10-04 03:01:13 +0000
965@@ -1,8 +1,10 @@
966-# Copyright 2009 Canonical Ltd. This software is licensed under the
967+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
968 # GNU Affero General Public License version 3 (see the file LICENSE).
969
970 """Helper methods for branch tests and pagetest."""
971
972+from __future__ import absolute_import, print_function, unicode_literals
973+
974 __metaclass__ = type
975 __all__ = [
976 'reset_all_branch_last_modified',
977
978=== modified file 'lib/lp/code/tests/codeimporthelpers.py'
979--- lib/lp/code/tests/codeimporthelpers.py 2015-10-19 10:56:16 +0000
980+++ lib/lp/code/tests/codeimporthelpers.py 2017-10-04 03:01:13 +0000
981@@ -1,8 +1,10 @@
982-# Copyright 2009 Canonical Ltd. This software is licensed under the
983+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
984 # GNU Affero General Public License version 3 (see the file LICENSE).
985
986 """Helpers for Code Import page tests."""
987
988+from __future__ import absolute_import, print_function, unicode_literals
989+
990 __metaclass__ = type
991 __all__ = [
992 'get_import_for_branch_name',
993
994=== modified file 'lib/lp/code/tests/helpers.py'
995--- lib/lp/code/tests/helpers.py 2017-05-19 15:50:01 +0000
996+++ lib/lp/code/tests/helpers.py 2017-10-04 03:01:13 +0000
997@@ -3,6 +3,8 @@
998
999 """Helper functions for code testing live here."""
1000
1001+from __future__ import absolute_import, print_function, unicode_literals
1002+
1003 __metaclass__ = type
1004 __all__ = [
1005 'add_revision_to_branch',
1006@@ -118,7 +120,7 @@
1007 # And fake a diff.
1008 naked_bmp = removeSecurityProxy(bmp)
1009 preview = removeSecurityProxy(naked_bmp.updatePreviewDiff(
1010- ''.join(unified_diff('', 'random content')), u'rev-a', u'rev-b'))
1011+ ''.join(unified_diff('', 'random content')), 'rev-a', 'rev-b'))
1012 naked_bmp.source_branch.last_scanned_id = preview.source_revision_id
1013 naked_bmp.target_branch.last_scanned_id = preview.target_revision_id
1014 preview.diff_lines_count = 47
1015@@ -302,12 +304,12 @@
1016 class GitHostingFixture(fixtures.Fixture):
1017 """A fixture that temporarily registers a fake Git hosting client."""
1018
1019- def __init__(self, default_branch=u"refs/heads/master",
1020+ def __init__(self, default_branch="refs/heads/master",
1021 refs=None, commits=None, log=None, diff=None, merge_diff=None,
1022 merges=None, blob=None, disable_memcache=True):
1023 self.create = FakeMethod()
1024 self.getProperties = FakeMethod(
1025- result={u"default_branch": default_branch})
1026+ result={"default_branch": default_branch})
1027 self.setProperties = FakeMethod()
1028 self.getRefs = FakeMethod(result=({} if refs is None else refs))
1029 self.getCommits = FakeMethod(
1030
1031=== modified file 'lib/lp/code/tests/test_branch.py'
1032--- lib/lp/code/tests/test_branch.py 2012-09-28 06:15:58 +0000
1033+++ lib/lp/code/tests/test_branch.py 2017-10-04 03:01:13 +0000
1034@@ -1,8 +1,10 @@
1035-# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
1036+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
1037 # GNU Affero General Public License version 3 (see the file LICENSE).
1038
1039 """Unit tests for methods of Branch and BranchSet."""
1040
1041+from __future__ import absolute_import, print_function, unicode_literals
1042+
1043 from zope.component import getUtility
1044 from zope.security.proxy import removeSecurityProxy
1045
1046
1047=== modified file 'lib/lp/code/tests/test_branch_access_policy_triggers.py'
1048--- lib/lp/code/tests/test_branch_access_policy_triggers.py 2013-06-20 05:50:00 +0000
1049+++ lib/lp/code/tests/test_branch_access_policy_triggers.py 2017-10-04 03:01:13 +0000
1050@@ -1,6 +1,8 @@
1051-# Copyright 2012 Canonical Ltd. This software is licensed under the
1052+# Copyright 2012-2017 Canonical Ltd. This software is licensed under the
1053 # GNU Affero General Public License version 3 (see the file LICENSE).
1054
1055+from __future__ import absolute_import, print_function, unicode_literals
1056+
1057 __metaclass__ = type
1058
1059 from zope.component import getUtility
1060
1061=== modified file 'lib/lp/code/tests/test_branch_webservice.py'
1062--- lib/lp/code/tests/test_branch_webservice.py 2016-11-11 14:24:38 +0000
1063+++ lib/lp/code/tests/test_branch_webservice.py 2017-10-04 03:01:13 +0000
1064@@ -1,6 +1,8 @@
1065-# Copyright 2011-2016 Canonical Ltd. This software is licensed under the
1066+# Copyright 2011-2017 Canonical Ltd. This software is licensed under the
1067 # GNU Affero General Public License version 3 (see the file LICENSE).
1068
1069+from __future__ import absolute_import, print_function, unicode_literals
1070+
1071 __metaclass__ = type
1072
1073 from lazr.restfulclient.errors import BadRequest
1074
1075=== modified file 'lib/lp/code/tests/test_branchmergeproposal.py'
1076--- lib/lp/code/tests/test_branchmergeproposal.py 2016-11-15 11:54:30 +0000
1077+++ lib/lp/code/tests/test_branchmergeproposal.py 2017-10-04 03:01:13 +0000
1078@@ -1,8 +1,9 @@
1079-# Copyright 2010 Canonical Ltd. This software is licensed under the
1080+# Copyright 2010-2017 Canonical Ltd. This software is licensed under the
1081 # GNU Affero General Public License version 3 (see the file LICENSE).
1082
1083 """Unit tests for methods of BranchMergeProposal."""
1084
1085+from __future__ import absolute_import, print_function, unicode_literals
1086
1087 from zope.component import getUtility
1088 from zope.security.proxy import removeSecurityProxy
1089
1090=== modified file 'lib/lp/code/tests/test_branchurifield.py'
1091--- lib/lp/code/tests/test_branchurifield.py 2012-01-01 02:58:52 +0000
1092+++ lib/lp/code/tests/test_branchurifield.py 2017-10-04 03:01:13 +0000
1093@@ -1,8 +1,10 @@
1094-# Copyright 2009 Canonical Ltd. This software is licensed under the
1095+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
1096 # GNU Affero General Public License version 3 (see the file LICENSE).
1097
1098 """Tests for BranchURIField."""
1099
1100+from __future__ import absolute_import, print_function, unicode_literals
1101+
1102 __metaclass__ = type
1103
1104 from lp.app.validators import LaunchpadValidationError
1105@@ -49,13 +51,13 @@
1106 # Branches on the supermirror are already registered, so there is no
1107 # need to register them, again.
1108 self.assertInvalid(
1109- u'%s/~user/+junk/branch' % config.codehosting.supermirror_root)
1110+ '%s/~user/+junk/branch' % config.codehosting.supermirror_root)
1111
1112 def test_notFromLaunchpad(self):
1113 # URIs from Launchpad itself are invalid, no matter what the
1114 # subdomain.
1115 for domain in self.listLaunchpadDomains():
1116- self.assertInvalid(u'http://%s/user/+junk/branch' % domain)
1117+ self.assertInvalid('http://%s/user/+junk/branch' % domain)
1118
1119 def test_get_blacklisted_hostnames(self):
1120 self.pushConfig(
1121@@ -71,5 +73,5 @@
1122 # allowed to be registered.
1123 self.pushConfig(
1124 'codehosting', blacklisted_hostnames='localhost,127.0.0.1')
1125- self.assertInvalid(u'http://localhost/foo/bar')
1126- self.assertInvalid(u'http://127.0.0.1/foo/bar')
1127+ self.assertInvalid('http://localhost/foo/bar')
1128+ self.assertInvalid('http://127.0.0.1/foo/bar')
1129
1130=== modified file 'lib/lp/code/tests/test_doc.py'
1131--- lib/lp/code/tests/test_doc.py 2015-09-02 16:54:24 +0000
1132+++ lib/lp/code/tests/test_doc.py 2017-10-04 03:01:13 +0000
1133@@ -1,10 +1,12 @@
1134-# Copyright 2009-2015 Canonical Ltd. This software is licensed under the
1135+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
1136 # GNU Affero General Public License version 3 (see the file LICENSE).
1137
1138 """
1139 Run the doctests and pagetests.
1140 """
1141
1142+from __future__ import absolute_import, print_function, unicode_literals
1143+
1144 import os
1145
1146 from zope.security.management import setSecurityPolicy
1147
1148=== modified file 'lib/lp/code/tests/test_helpers.py'
1149--- lib/lp/code/tests/test_helpers.py 2012-01-01 02:58:52 +0000
1150+++ lib/lp/code/tests/test_helpers.py 2017-10-04 03:01:13 +0000
1151@@ -1,8 +1,10 @@
1152-# Copyright 2010 Canonical Ltd. This software is licensed under the
1153+# Copyright 2010-2017 Canonical Ltd. This software is licensed under the
1154 # GNU Affero General Public License version 3 (see the file LICENSE).
1155
1156 """Test the code test helpers found in helpers.py."""
1157
1158+from __future__ import absolute_import, print_function, unicode_literals
1159+
1160 __metaclass__ = type
1161
1162 from datetime import (
1163
1164=== modified file 'lib/lp/code/tests/test_project.py'
1165--- lib/lp/code/tests/test_project.py 2015-01-29 14:14:01 +0000
1166+++ lib/lp/code/tests/test_project.py 2017-10-04 03:01:13 +0000
1167@@ -1,8 +1,10 @@
1168-# Copyright 2010 Canonical Ltd. This software is licensed under the
1169+# Copyright 2010-2017 Canonical Ltd. This software is licensed under the
1170 # GNU Affero General Public License version 3 (see the file LICENSE).
1171
1172 """Tests for product views."""
1173
1174+from __future__ import absolute_import, print_function, unicode_literals
1175+
1176 __metaclass__ = type
1177
1178 from lp.testing import TestCaseWithFactory
1179
1180=== modified file 'lib/lp/code/tests/test_publisher.py'
1181--- lib/lp/code/tests/test_publisher.py 2012-01-01 02:58:52 +0000
1182+++ lib/lp/code/tests/test_publisher.py 2017-10-04 03:01:13 +0000
1183@@ -1,8 +1,10 @@
1184-# Copyright 2010 Canonical Ltd. This software is licensed under the
1185+# Copyright 2010-2017 Canonical Ltd. This software is licensed under the
1186 # GNU Affero General Public License version 3 (see the file LICENSE).
1187
1188 """Tests for code's custom publications."""
1189
1190+from __future__ import absolute_import, print_function, unicode_literals
1191+
1192 __metaclass__ = type
1193
1194 from lp.code.publisher import CodeLayer
1195
1196=== modified file 'lib/lp/code/tests/test_seriessourcepackagebranch.py'
1197--- lib/lp/code/tests/test_seriessourcepackagebranch.py 2012-01-01 02:58:52 +0000
1198+++ lib/lp/code/tests/test_seriessourcepackagebranch.py 2017-10-04 03:01:13 +0000
1199@@ -1,8 +1,10 @@
1200-# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
1201+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
1202 # GNU Affero General Public License version 3 (see the file LICENSE).
1203
1204 """Tests for ISeriesSourcePackageBranch."""
1205
1206+from __future__ import absolute_import, print_function, unicode_literals
1207+
1208 __metaclass__ = type
1209
1210 from datetime import datetime
1211
1212=== modified file 'lib/lp/code/tests/test_yuitests.py'
1213--- lib/lp/code/tests/test_yuitests.py 2012-01-01 02:58:52 +0000
1214+++ lib/lp/code/tests/test_yuitests.py 2017-10-04 03:01:13 +0000
1215@@ -1,8 +1,10 @@
1216-# Copyright 2010 Canonical Ltd. This software is licensed under the
1217+# Copyright 2010-2017 Canonical Ltd. This software is licensed under the
1218 # GNU Affero General Public License version 3 (see the file LICENSE).
1219
1220 """Run YUI.test tests."""
1221
1222+from __future__ import absolute_import, print_function, unicode_literals
1223+
1224 __metaclass__ = type
1225 __all__ = []
1226