← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/code-tests-future-imports into lp:launchpad with lp:~cjwatson/launchpad/code-bzr-tests-future-imports as a prerequisite.

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

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/code-tests-future-imports/+merge/331764
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/code-tests-future-imports into lp:launchpad.
=== modified file 'lib/lp/code/model/tests/test_branchcloud.py'
--- lib/lp/code/model/tests/test_branchcloud.py	2012-01-01 02:58:52 +0000
+++ lib/lp/code/model/tests/test_branchcloud.py	2017-10-04 02:07:15 +0000
@@ -1,8 +1,10 @@
-# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for IBranchCloud provider."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from datetime import (

=== modified file 'lib/lp/code/model/tests/test_branchcollection.py'
--- lib/lp/code/model/tests/test_branchcollection.py	2017-06-15 01:02:11 +0000
+++ lib/lp/code/model/tests/test_branchcollection.py	2017-10-04 02:07:15 +0000
@@ -3,6 +3,8 @@
 
 """Tests for branch collections."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from datetime import (

=== modified file 'lib/lp/code/model/tests/test_branchlistingqueryoptimiser.py'
--- lib/lp/code/model/tests/test_branchlistingqueryoptimiser.py	2014-06-10 16:13:03 +0000
+++ lib/lp/code/model/tests/test_branchlistingqueryoptimiser.py	2017-10-04 02:07:15 +0000
@@ -1,8 +1,10 @@
-# Copyright 2009-2014 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for the branch listing query optimiser."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from storm.store import Store

=== modified file 'lib/lp/code/model/tests/test_branchlookup.py'
--- lib/lp/code/model/tests/test_branchlookup.py	2015-09-29 15:00:10 +0000
+++ lib/lp/code/model/tests/test_branchlookup.py	2017-10-04 02:07:15 +0000
@@ -1,8 +1,10 @@
-# Copyright 2009-2012 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for the IBranchLookup implementation."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from lazr.uri import URI
@@ -746,7 +748,7 @@
         series = self.factory.makeProductSeries(branch=branch)
         result = self.branch_lookup.getByLPPath(
             '%s/%s/other/bits' % (series.product.name, series.name))
-        self.assertEqual((branch, u'other/bits'), result)
+        self.assertEqual((branch, 'other/bits'), result)
 
     def test_too_long_sourcepackage(self):
         package = self.factory.makeSourcePackage()
@@ -757,7 +759,7 @@
                 package.distribution.owner)
         result = self.branch_lookup.getByLPPath(
             '%s/other/bits' % package.path)
-        self.assertEqual((branch, u'other/bits'), result)
+        self.assertEqual((branch, 'other/bits'), result)
 
 
 class PerformLookupTestCase(TestCaseWithFactory):

=== modified file 'lib/lp/code/model/tests/test_branchmergeproposal.py'
--- lib/lp/code/model/tests/test_branchmergeproposal.py	2017-05-23 08:24:55 +0000
+++ lib/lp/code/model/tests/test_branchmergeproposal.py	2017-10-04 02:07:15 +0000
@@ -3,6 +3,8 @@
 
 """Tests for BranchMergeProposals."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from datetime import (
@@ -641,7 +643,7 @@
         self.mp_one = self.factory.makeBranchMergeProposal()
         self.mp_two = self.factory.makeBranchMergeProposal()
         self.preview_diff = self.mp_one.updatePreviewDiff(
-            'Some diff', u"source_id", u"target_id")
+            'Some diff', "source_id", "target_id")
         transaction.commit()
 
     def test_getPreviewDiff(self):
@@ -1500,22 +1502,22 @@
         bmp = self._makeBranchMergeProposal()
         self.hosting_fixture.getLog.result = [
             {
-                u"sha1": bmp.source_git_commit_sha1,
-                u"message": u"Commit 1\n\nLP: #%d" % bugs[0].id,
+                "sha1": bmp.source_git_commit_sha1,
+                "message": "Commit 1\n\nLP: #%d" % bugs[0].id,
                 },
             {
-                u"sha1": unicode(hashlib.sha1("1").hexdigest()),
+                "sha1": unicode(hashlib.sha1("1").hexdigest()),
                 # Will not be matched.
-                u"message": u"Commit 2; see LP #%d" % bugs[1].id,
-                },
-            {
-                u"sha1": unicode(hashlib.sha1("2").hexdigest()),
-                u"message": u"Commit 3; LP: #%d" % bugs[2].id,
-                },
-            {
-                u"sha1": unicode(hashlib.sha1("3").hexdigest()),
+                "message": "Commit 2; see LP #%d" % bugs[1].id,
+                },
+            {
+                "sha1": unicode(hashlib.sha1("2").hexdigest()),
+                "message": "Commit 3; LP: #%d" % bugs[2].id,
+                },
+            {
+                "sha1": unicode(hashlib.sha1("3").hexdigest()),
                 # Non-existent bug ID will not be returned.
-                u"message": u"Non-existent bug; LP: #%d" % (bugs[2].id + 100),
+                "message": "Non-existent bug; LP: #%d" % (bugs[2].id + 100),
                 },
             ]
         related_bugs = bmp._fetchRelatedBugIDsFromSource()
@@ -1533,8 +1535,8 @@
         """Set up a fake log response referring to the given bugs."""
         self.hosting_fixture.getLog.result = [
             {
-                u"sha1": unicode(hashlib.sha1(str(i)).hexdigest()),
-                u"message": u"LP: #%d" % bug.id,
+                "sha1": unicode(hashlib.sha1(str(i)).hexdigest()),
+                "message": "LP: #%d" % bug.id,
                 }
             for i, bug in enumerate(bugs)]
         self.hosting_fixture.memcache_fixture.clear()
@@ -1595,15 +1597,15 @@
         bmp.updateRelatedBugsFromSource()
         self.assertEqual([bug], bmp.bugs)
         matches_expected_xref = MatchesDict(
-            {(u"bug", unicode(bug.id)): ContainsDict({"metadata": Is(None)})})
+            {("bug", unicode(bug.id)): ContainsDict({"metadata": Is(None)})})
         self.assertThat(
             getUtility(IXRefSet).findFrom(
-                (u"merge_proposal", unicode(bmp.id)), types=[u"bug"]),
+                ("merge_proposal", unicode(bmp.id)), types=["bug"]),
             matches_expected_xref)
         self._setUpLog([bug])
         self.assertThat(
             getUtility(IXRefSet).findFrom(
-                (u"merge_proposal", unicode(bmp.id)), types=[u"bug"]),
+                ("merge_proposal", unicode(bmp.id)), types=["bug"]),
             matches_expected_xref)
 
     def test_updateRelatedBugsFromSource_honours_limit(self):
@@ -2101,8 +2103,7 @@
             " from lp.services.config import config\n")
         diff_stat = {'sample': (1, 1)}
         login_person(merge_proposal.registrant)
-        merge_proposal.updatePreviewDiff(
-            diff_text, u"source_id", u"target_id")
+        merge_proposal.updatePreviewDiff(diff_text, "source_id", "target_id")
         # Have to commit the transaction to make the Librarian file
         # available.
         transaction.commit()
@@ -2120,7 +2121,7 @@
         merge_proposal = self.factory.makeBranchMergeProposal()
         login_person(merge_proposal.registrant)
         diff_bytes = ''.join(unified_diff('', 'random text'))
-        merge_proposal.updatePreviewDiff(diff_bytes, u"a", u"b")
+        merge_proposal.updatePreviewDiff(diff_bytes, "a", "b")
         transaction.commit()
         # Extract the primary key ids for the preview diff and the diff to
         # show that we are not reusing the objects.
@@ -2607,7 +2608,7 @@
         review_comment = ws_bmp.createComment(
             subject='Testing!',
             previewdiff_id=previewdiff.id,
-            inline_comments={u'2': u'foo'})
+            inline_comments={'2': 'foo'})
         transaction.commit()
 
         # Retrieving published inline comments requires only lp.View

=== modified file 'lib/lp/code/model/tests/test_branchmergeproposaljobs.py'
--- lib/lp/code/model/tests/test_branchmergeproposaljobs.py	2017-06-29 18:05:23 +0000
+++ lib/lp/code/model/tests/test_branchmergeproposaljobs.py	2017-10-04 02:07:15 +0000
@@ -3,6 +3,8 @@
 
 """Tests for branch merge proposal jobs."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from datetime import (
@@ -275,11 +277,11 @@
         committer = self.factory.makePerson()
         self.hosting_fixture.getLog.result = [
             {
-                u"sha1": unicode(hashlib.sha1("tip").hexdigest()),
-                u"message": u"Fix upside-down messages\n\nLP: #%d" % bug.id,
-                u"committer": {
-                    u"name": committer.display_name,
-                    u"email": committer.preferredemail.email,
+                "sha1": unicode(hashlib.sha1("tip").hexdigest()),
+                "message": "Fix upside-down messages\n\nLP: #%d" % bug.id,
+                "committer": {
+                    "name": committer.display_name,
+                    "email": committer.preferredemail.email,
                     },
                 },
             ]

=== modified file 'lib/lp/code/model/tests/test_branchnamespace.py'
--- lib/lp/code/model/tests/test_branchnamespace.py	2016-09-30 13:27:27 +0000
+++ lib/lp/code/model/tests/test_branchnamespace.py	2017-10-04 02:07:15 +0000
@@ -1,8 +1,10 @@
-# Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for `IBranchNamespace` implementations."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from zope.component import getUtility

=== modified file 'lib/lp/code/model/tests/test_branchpuller.py'
--- lib/lp/code/model/tests/test_branchpuller.py	2012-09-18 18:36:09 +0000
+++ lib/lp/code/model/tests/test_branchpuller.py	2017-10-04 02:07:15 +0000
@@ -1,8 +1,10 @@
-# Copyright 2009-2012 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for the branch puller model code."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from datetime import (

=== modified file 'lib/lp/code/model/tests/test_branchset.py'
--- lib/lp/code/model/tests/test_branchset.py	2015-09-30 00:38:30 +0000
+++ lib/lp/code/model/tests/test_branchset.py	2017-10-04 02:07:15 +0000
@@ -1,8 +1,10 @@
-# Copyright 2009-2012 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for BranchSet."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from testtools.matchers import LessThan

=== modified file 'lib/lp/code/model/tests/test_branchsubscription.py'
--- lib/lp/code/model/tests/test_branchsubscription.py	2015-04-15 18:21:48 +0000
+++ lib/lp/code/model/tests/test_branchsubscription.py	2017-10-04 02:07:15 +0000
@@ -1,11 +1,12 @@
-# Copyright 2010-2015 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for the BranchSubscription model object."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
-
 from zope.component import getUtility
 
 from lp.app.enums import InformationType

=== modified file 'lib/lp/code/model/tests/test_branchtarget.py'
--- lib/lp/code/model/tests/test_branchtarget.py	2016-10-03 10:54:48 +0000
+++ lib/lp/code/model/tests/test_branchtarget.py	2017-10-04 02:07:15 +0000
@@ -1,8 +1,10 @@
-# Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for branch contexts."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from zope.security.proxy import removeSecurityProxy

=== modified file 'lib/lp/code/model/tests/test_branchvisibility.py'
--- lib/lp/code/model/tests/test_branchvisibility.py	2016-01-26 15:47:37 +0000
+++ lib/lp/code/model/tests/test_branchvisibility.py	2017-10-04 02:07:15 +0000
@@ -1,4 +1,4 @@
-# Copyright 2011-2012 Canonical Ltd.  This software is licensed under the
+# Copyright 2011-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for visibility of branches.
@@ -10,6 +10,8 @@
 are only visible to the owner of the branch, and the subscribers.
 """
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from zope.component import (

=== modified file 'lib/lp/code/model/tests/test_codeimport.py'
--- lib/lp/code/model/tests/test_codeimport.py	2016-10-15 01:59:02 +0000
+++ lib/lp/code/model/tests/test_codeimport.py	2017-10-04 02:07:15 +0000
@@ -1,8 +1,10 @@
-# Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Unit tests for methods of CodeImport and CodeImportSet."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 from datetime import (
     datetime,
     timedelta,
@@ -95,7 +97,7 @@
             CodeImportSet().new,
             registrant=self.factory.makePerson(),
             context=self.factory.makeProduct(),
-            branch_name=u'imported',
+            branch_name='imported',
             rcs_type=RevisionControlSystems.BZR_SVN,
             target_rcs_type=self.target_rcs_type,
             url=self.factory.getUniqueURL(scheme="svn"))
@@ -115,7 +117,7 @@
             CodeImportSet().new,
             registrant=self.factory.makePerson(),
             context=self.factory.makeProduct(),
-            branch_name=u'imported',
+            branch_name='imported',
             rcs_type=RevisionControlSystems.BZR_SVN,
             target_rcs_type=self.target_rcs_type,
             url=self.factory.getUniqueURL(),
@@ -136,11 +138,11 @@
             CodeImportSet().new,
             registrant=self.factory.makePerson(),
             context=self.factory.makeProduct(),
-            branch_name=u'imported',
+            branch_name='imported',
             rcs_type=RevisionControlSystems.CVS,
             target_rcs_type=self.target_rcs_type,
             cvs_root=self.factory.getUniqueURL(),
-            cvs_module=u'module',
+            cvs_module='module',
             review_status=None)
         if self.supports_source_cvs:
             code_import = create_func()
@@ -157,7 +159,7 @@
         code_import = CodeImportSet().new(
             registrant=self.factory.makePerson(),
             context=self.factory.makeProduct(),
-            branch_name=u'imported',
+            branch_name='imported',
             rcs_type=RevisionControlSystems.GIT,
             target_rcs_type=self.target_rcs_type,
             url=self.factory.getUniqueURL(scheme="git"),
@@ -178,7 +180,7 @@
         code_import = CodeImportSet().new(
             registrant=self.factory.makePerson(),
             context=self.factory.makeProduct(),
-            branch_name=u'imported',
+            branch_name='imported',
             rcs_type=RevisionControlSystems.GIT,
             target_rcs_type=self.target_rcs_type,
             url=self.factory.getUniqueURL(),
@@ -200,7 +202,7 @@
             CodeImportSet().new,
             registrant=self.factory.makePerson(),
             context=self.factory.makeProduct(),
-            branch_name=u'mirrored',
+            branch_name='mirrored',
             rcs_type=RevisionControlSystems.BZR,
             target_rcs_type=self.target_rcs_type,
             url=self.factory.getUniqueURL(),
@@ -221,7 +223,7 @@
         self.assertRaises(AssertionError, CodeImportSet().new,
             registrant=registrant,
             context=registrant,
-            branch_name=u'imported',
+            branch_name='imported',
             rcs_type=RevisionControlSystems.GIT,
             target_rcs_type=self.target_rcs_type,
             url=self.factory.getUniqueURL(),
@@ -238,7 +240,7 @@
         code_import = CodeImportSet().new(
             registrant=registrant,
             context=context,
-            branch_name=u'imported',
+            branch_name='imported',
             rcs_type=RevisionControlSystems.GIT,
             target_rcs_type=self.target_rcs_type,
             url=self.factory.getUniqueURL(),
@@ -268,7 +270,7 @@
         code_import = CodeImportSet().new(
             registrant=registrant,
             context=context,
-            branch_name=u'imported',
+            branch_name='imported',
             rcs_type=RevisionControlSystems.GIT,
             target_rcs_type=self.target_rcs_type,
             url=self.factory.getUniqueURL(),
@@ -303,7 +305,7 @@
             CodeImportSet().new,
             registrant=registrant,
             context=context,
-            branch_name=u'imported',
+            branch_name='imported',
             rcs_type=RevisionControlSystems.GIT,
             target_rcs_type=self.target_rcs_type,
             url=self.factory.getUniqueURL(),

=== modified file 'lib/lp/code/model/tests/test_codeimportjob.py'
--- lib/lp/code/model/tests/test_codeimportjob.py	2016-12-31 05:02:35 +0000
+++ lib/lp/code/model/tests/test_codeimportjob.py	2017-10-04 02:07:15 +0000
@@ -1,8 +1,10 @@
-# Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Unit tests for CodeImportJob and CodeImportJobWorkflow."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 __all__ = [
@@ -127,7 +129,7 @@
         if state == CodeImportJobState.RUNNING:
             getUtility(ICodeImportJobWorkflow).startJob(job, self.machine)
         naked_job = removeSecurityProxy(job)
-        naked_job.date_due = UTC_NOW + u'%d days' % date_due_delta
+        naked_job.date_due = UTC_NOW + '%d days' % date_due_delta
         naked_job.requesting_user = requesting_user
         return job
 
@@ -235,7 +237,7 @@
     def makeJobWithHeartbeatInPast(self, seconds_in_past):
         code_import = make_running_import(factory=self.factory)
         naked_job = removeSecurityProxy(code_import.import_job)
-        naked_job.heartbeat = UTC_NOW + u'%d seconds' % -seconds_in_past
+        naked_job.heartbeat = UTC_NOW + '%d seconds' % -seconds_in_past
         return code_import.import_job
 
     def assertReclaimableJobs(self, jobs):
@@ -701,7 +703,7 @@
             "The CodeImportJob associated with %s is "
             "PENDING." % code_import.branch.unique_name,
             getUtility(ICodeImportJobWorkflow).updateHeartbeat,
-            job, u'')
+            job, '')
 
     def test_updateHeartboat(self):
         code_import = self.factory.makeCodeImport()
@@ -712,9 +714,9 @@
         # Set heartbeat to something wrong so that we can prove that it was
         # changed.
         removeSecurityProxy(job).heartbeat = None
-        workflow.updateHeartbeat(job, u'some interesting log output')
+        workflow.updateHeartbeat(job, 'some interesting log output')
         self.assertSqlAttributeEqualsDate(job, 'heartbeat', UTC_NOW)
-        self.assertEqual(u'some interesting log output', job.logtail)
+        self.assertEqual('some interesting log output', job.logtail)
 
 
 class TestCodeImportJobWorkflowFinishJob(TestCaseWithFactory,
@@ -1126,7 +1128,7 @@
         self.requestJobByUserWithDisplayName(code_import_id, "New User")
         user_browser.getControl('Import Now').click()
         self.assertEqual(
-            [u'The import has already been requested by New User.'],
+            ['The import has already been requested by New User.'],
             get_feedback_messages(user_browser.contents))
 
     def test_pressButtonJobDeleted(self):
@@ -1137,7 +1139,7 @@
         self.deleteJob(code_import_id)
         user_browser.getControl('Import Now').click()
         self.assertEqual(
-            [u'This import is no longer being updated automatically.'],
+            ['This import is no longer being updated automatically.'],
             get_feedback_messages(user_browser.contents))
 
     def test_pressButtonJobStarted(self):
@@ -1147,7 +1149,7 @@
         self.startJob(code_import_id)
         user_browser.getControl('Import Now').click()
         self.assertEqual(
-            [u'The import is already running.'],
+            ['The import is already running.'],
             get_feedback_messages(user_browser.contents))
 
 

=== modified file 'lib/lp/code/model/tests/test_codeimportmachine.py'
--- lib/lp/code/model/tests/test_codeimportmachine.py	2011-12-30 06:14:56 +0000
+++ lib/lp/code/model/tests/test_codeimportmachine.py	2017-10-04 02:07:15 +0000
@@ -1,10 +1,12 @@
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Unit tests for methods of CodeImportMachine.
 
 Other tests are in codeimport-machine.txt."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 from zope.component import getUtility
 
 from lp.code.enums import (

=== modified file 'lib/lp/code/model/tests/test_codeimportresult.py'
--- lib/lp/code/model/tests/test_codeimportresult.py	2012-01-01 02:58:52 +0000
+++ lib/lp/code/model/tests/test_codeimportresult.py	2017-10-04 02:07:15 +0000
@@ -1,8 +1,10 @@
-# Copyright 2011 Canonical Ltd.  This software is licensed under the
+# Copyright 2011-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for CodeImportResult."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from datetime import datetime

=== modified file 'lib/lp/code/model/tests/test_codereviewcomment.py'
--- lib/lp/code/model/tests/test_codereviewcomment.py	2015-10-06 16:09:06 +0000
+++ lib/lp/code/model/tests/test_codereviewcomment.py	2017-10-04 02:07:15 +0000
@@ -1,8 +1,10 @@
-# Copyright 2009-2015 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Unit tests for CodeReviewComment"""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 from textwrap import dedent
 
 from lazr.lifecycle.event import ObjectCreatedEvent

=== modified file 'lib/lp/code/model/tests/test_codereviewinlinecomment.py'
--- lib/lp/code/model/tests/test_codereviewinlinecomment.py	2014-04-04 04:30:48 +0000
+++ lib/lp/code/model/tests/test_codereviewinlinecomment.py	2017-10-04 02:07:15 +0000
@@ -1,8 +1,10 @@
-# Copyright 2013 Canonical Ltd.  This software is licensed under the
+# Copyright 2013-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for CodeReviewInlineComment{,Draft,Set}"""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from datetime import datetime

=== modified file 'lib/lp/code/model/tests/test_codereviewkarma.py'
--- lib/lp/code/model/tests/test_codereviewkarma.py	2015-10-05 17:03:27 +0000
+++ lib/lp/code/model/tests/test_codereviewkarma.py	2017-10-04 02:07:15 +0000
@@ -1,8 +1,10 @@
-# Copyright 2009-2015 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for karma allocated for code reviews."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from lp.code.interfaces.branchmergeproposal import notify_modified

=== modified file 'lib/lp/code/model/tests/test_codereviewvote.py'
--- lib/lp/code/model/tests/test_codereviewvote.py	2011-12-30 06:14:56 +0000
+++ lib/lp/code/model/tests/test_codereviewvote.py	2017-10-04 02:07:15 +0000
@@ -1,6 +1,8 @@
-# Copyright 2009-2010 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 from zope.security.interfaces import Unauthorized
 
 from lp.code.enums import CodeReviewVote

=== modified file 'lib/lp/code/model/tests/test_hasbranches.py'
--- lib/lp/code/model/tests/test_hasbranches.py	2016-09-09 12:36:04 +0000
+++ lib/lp/code/model/tests/test_hasbranches.py	2017-10-04 02:07:15 +0000
@@ -1,8 +1,10 @@
-# Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for classes that implement IHasBranches."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from functools import partial

=== modified file 'lib/lp/code/model/tests/test_hasmergeproposals.py'
--- lib/lp/code/model/tests/test_hasmergeproposals.py	2012-01-01 02:58:52 +0000
+++ lib/lp/code/model/tests/test_hasmergeproposals.py	2017-10-04 02:07:15 +0000
@@ -1,8 +1,10 @@
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for classes that implement IHasMergeProposals."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from zope.interface.verify import verifyObject

=== modified file 'lib/lp/code/model/tests/test_hasrecipes.py'
--- lib/lp/code/model/tests/test_hasrecipes.py	2016-10-14 16:16:18 +0000
+++ lib/lp/code/model/tests/test_hasrecipes.py	2017-10-04 02:07:15 +0000
@@ -1,8 +1,10 @@
-# Copyright 2010-2016 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for classes that implement IHasRecipes."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from lp.code.interfaces.hasrecipes import IHasRecipes
@@ -48,7 +50,7 @@
         # IGitRepository.recipes should provide all the SourcePackageRecipes
         # attached to that repository.
         base_ref1, base_ref2 = self.factory.makeGitRefs(
-            paths=[u"refs/heads/ref1", u"refs/heads/ref2"])
+            paths=["refs/heads/ref1", "refs/heads/ref2"])
         [other_ref] = self.factory.makeGitRefs()
         self.factory.makeSourcePackageRecipe(branches=[base_ref1])
         self.factory.makeSourcePackageRecipe(branches=[base_ref2])

=== modified file 'lib/lp/code/model/tests/test_linkedbranch.py'
--- lib/lp/code/model/tests/test_linkedbranch.py	2016-12-31 05:02:35 +0000
+++ lib/lp/code/model/tests/test_linkedbranch.py	2017-10-04 02:07:15 +0000
@@ -1,8 +1,10 @@
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for linked branch implementations."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from zope.security.proxy import removeSecurityProxy

=== modified file 'lib/lp/code/model/tests/test_recipebuilder.py'
--- lib/lp/code/model/tests/test_recipebuilder.py	2017-07-26 13:21:25 +0000
+++ lib/lp/code/model/tests/test_recipebuilder.py	2017-10-04 02:07:15 +0000
@@ -3,6 +3,8 @@
 
 """Test RecipeBuildBehaviour."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 import os.path
@@ -88,16 +90,16 @@
             recipe_owner = recipe_registrant
         if git:
             [somebranch] = self.factory.makeGitRefs(
-                owner=recipe_owner, name=u"pkg",
+                owner=recipe_owner, name="pkg",
                 target=self.factory.makeProduct("someapp"),
-                paths=[u"refs/heads/packaging"])
+                paths=["refs/heads/packaging"])
         else:
             somebranch = self.factory.makeBranch(
                 owner=recipe_owner, name="pkg",
                 product=self.factory.makeProduct("someapp"))
         recipe = self.factory.makeSourcePackageRecipe(
-            recipe_registrant, recipe_owner, distroseries, u"recept",
-            u"Recipe description", branches=[somebranch])
+            recipe_registrant, recipe_owner, distroseries, "recept",
+            "Recipe description", branches=[somebranch])
         spb = self.factory.makeSourcePackageRecipeBuild(
             sourcepackage=sourcepackage, archive=archive,
             recipe=recipe, requester=recipe_owner, distroseries=distroseries)
@@ -181,10 +183,10 @@
         self.assertEqual({
             'archive_private': False,
             'arch_tag': 'i386',
-            'author_email': u'requester@xxxxxxxxxx',
+            'author_email': 'requester@xxxxxxxxxx',
             'series': job.build.distroseries.name,
-            'suite': u'mydistro',
-            'author_name': u'Joe User',
+            'suite': 'mydistro',
+            'author_name': 'Joe User',
             'archive_purpose': 'PPA',
             'ogrecomponent': 'universe',
             'recipe_text':
@@ -274,10 +276,10 @@
         self.assertEqual({
             'archive_private': False,
             'arch_tag': 'i386',
-            'author_email': u'requester@xxxxxxxxxx',
+            'author_email': 'requester@xxxxxxxxxx',
             'series': job.build.distroseries.name,
-            'suite': u'mydistro',
-            'author_name': u'Joe User',
+            'suite': 'mydistro',
+            'author_name': 'Joe User',
             'archive_purpose': 'PPA',
             'ogrecomponent': 'universe',
             'recipe_text':
@@ -315,10 +317,10 @@
         self.assertEqual({
             'archive_private': False,
             'arch_tag': 'i386',
-            'author_email': u'requester@xxxxxxxxxx',
+            'author_email': 'requester@xxxxxxxxxx',
             'series': job.build.distroseries.name,
-            'suite': u'mydistro',
-            'author_name': u'Joe User',
+            'suite': 'mydistro',
+            'author_name': 'Joe User',
             'archive_purpose': 'PPA',
             'ogrecomponent': 'universe',
             'recipe_text':

=== modified file 'lib/lp/code/model/tests/test_revisionauthor.py'
--- lib/lp/code/model/tests/test_revisionauthor.py	2013-07-04 07:58:00 +0000
+++ lib/lp/code/model/tests/test_revisionauthor.py	2017-10-04 02:07:15 +0000
@@ -1,8 +1,10 @@
-# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for RevisionAuthors."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 import transaction

=== modified file 'lib/lp/code/model/tests/test_revisioncache.py'
--- lib/lp/code/model/tests/test_revisioncache.py	2015-01-29 14:14:01 +0000
+++ lib/lp/code/model/tests/test_revisioncache.py	2017-10-04 02:07:15 +0000
@@ -1,8 +1,10 @@
-# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests relating to the revision cache."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from datetime import (

=== modified file 'lib/lp/code/model/tests/test_seriessourcepackagebranch.py'
--- lib/lp/code/model/tests/test_seriessourcepackagebranch.py	2012-01-01 02:58:52 +0000
+++ lib/lp/code/model/tests/test_seriessourcepackagebranch.py	2017-10-04 02:07:15 +0000
@@ -1,8 +1,10 @@
-# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Model tests for distro series source package branch links."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from lp.code.model.seriessourcepackagebranch import (

=== modified file 'lib/lp/code/model/tests/test_sourcepackagerecipe.py'
--- lib/lp/code/model/tests/test_sourcepackagerecipe.py	2017-06-16 10:02:47 +0000
+++ lib/lp/code/model/tests/test_sourcepackagerecipe.py	2017-10-04 02:07:15 +0000
@@ -3,6 +3,8 @@
 
 """Tests for the SourcePackageRecipe content type."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from datetime import (
@@ -183,8 +185,8 @@
             registrant=registrant,
             owner=self.factory.makeTeam(owner=registrant),
             distroseries=[self.factory.makeDistroSeries()],
-            name=self.factory.getUniqueString(u'recipe-name'),
-            description=self.factory.getUniqueString(u'recipe-description'),
+            name=self.factory.getUniqueString('recipe-name'),
+            description=self.factory.getUniqueString('recipe-description'),
             recipe=self.factory.makeRecipeText(*branches))
 
     def test_creation(self):
@@ -243,7 +245,7 @@
 
         self.assertFalse(
             getUtility(ISourcePackageRecipeSource).exists(
-                recipe.owner, u'daily'))
+                recipe.owner, 'daily'))
 
     def test_source_implements_interface(self):
         # The SourcePackageRecipe class implements ISourcePackageRecipeSource.
@@ -541,7 +543,7 @@
 
     def test_sourcepackagerecipe_description(self):
         """Ensure that the SourcePackageRecipe has a proper description."""
-        description = u'The whoozits and whatzits.'
+        description = 'The whoozits and whatzits.'
         source_package_recipe = self.makeSourcePackageRecipe(
             description=description)
         self.assertEqual(description, source_package_recipe.description)
@@ -862,8 +864,8 @@
         registrant = self.factory.makePerson()
         owner = self.factory.makeTeam(owner=registrant)
         distroseries = self.factory.makeDistroSeries()
-        name = self.factory.getUniqueString(u'recipe-name')
-        description = self.factory.getUniqueString(u'recipe-description')
+        name = self.factory.getUniqueString('recipe-name')
+        description = self.factory.getUniqueString('recipe-description')
         recipe = getUtility(ISourcePackageRecipeSource).new(
             registrant=registrant, owner=owner, distroseries=[distroseries],
             name=name, description=description, recipe=recipe_text)
@@ -1147,7 +1149,7 @@
             daily_build_archive=ws_archive)
         # at the moment, distroseries is not exposed in the API.
         transaction.commit()
-        db_recipe = owner.getRecipe(name=u'toaster-1')
+        db_recipe = owner.getRecipe(name='toaster-1')
         self.assertEqual(set([db_distroseries]), set(db_recipe.distroseries))
         return recipe, ws_owner, launchpad
 

=== modified file 'lib/lp/code/model/tests/test_sourcepackagerecipebuild.py'
--- lib/lp/code/model/tests/test_sourcepackagerecipebuild.py	2016-01-12 01:24:06 +0000
+++ lib/lp/code/model/tests/test_sourcepackagerecipebuild.py	2017-10-04 02:07:15 +0000
@@ -1,8 +1,10 @@
-# Copyright 2010-2016 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for source package builds."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from datetime import (
@@ -247,7 +249,7 @@
         # that a build is requested for gets logged.
         owner = self.factory.makePerson(name='eric')
         self.factory.makeSourcePackageRecipe(
-            owner=owner, name=u'funky-recipe', build_daily=True)
+            owner=owner, name='funky-recipe', build_daily=True)
         logger = BufferLogger()
         SourcePackageRecipeBuild.makeDailyBuilds(logger)
         self.assertEqual(
@@ -284,7 +286,7 @@
         # makeDailyBuilds() won't create a build.
         owner = self.factory.makePerson(name='eric')
         recipe = self.factory.makeSourcePackageRecipe(
-            owner=owner, name=u'funky-recipe', build_daily=True,
+            owner=owner, name='funky-recipe', build_daily=True,
             is_stale=True)
         series = list(recipe.distroseries)[0]
         self.factory.makeSourcePackageRecipeBuild(
@@ -307,7 +309,7 @@
         # won't create a build.
         owner = self.factory.makePerson(name='eric')
         recipe = self.factory.makeSourcePackageRecipe(
-            owner=owner, name=u'funky-recipe', build_daily=True,
+            owner=owner, name='funky-recipe', build_daily=True,
             is_stale=True)
         archive = self.factory.makeArchive(owner=recipe.owner, name="ppa")
         removeSecurityProxy(recipe).daily_build_archive = archive
@@ -327,7 +329,7 @@
         # insufficient permissions, makeDailyBuilds() won't create a build.
         owner = self.factory.makePerson(name='eric')
         recipe = self.factory.makeSourcePackageRecipe(
-            owner=owner, name=u'funky-recipe', build_daily=True,
+            owner=owner, name='funky-recipe', build_daily=True,
             is_stale=True)
         archive = self.factory.makeArchive(name="ppa")
         removeSecurityProxy(recipe).daily_build_archive = archive
@@ -485,9 +487,9 @@
         """
         person = self.factory.makePerson(name='person')
         cake = self.factory.makeSourcePackageRecipe(
-            name=u'recipe', owner=person)
+            name='recipe', owner=person)
         pantry = self.factory.makeArchive(name='ppa')
-        secret = self.factory.makeDistroSeries(name=u'distroseries')
+        secret = self.factory.makeDistroSeries(name='distroseries')
         secret.nominatedarchindep = self.factory.makeDistroArchSeries(
             distroseries=secret)
         build = self.factory.makeSourcePackageRecipeBuild(
@@ -501,9 +503,9 @@
         """Notify does nothing if recipe has been deleted."""
         person = self.factory.makePerson(name='person')
         cake = self.factory.makeSourcePackageRecipe(
-            name=u'recipe', owner=person)
+            name='recipe', owner=person)
         pantry = self.factory.makeArchive(name='ppa')
-        secret = self.factory.makeDistroSeries(name=u'distroseries')
+        secret = self.factory.makeDistroSeries(name='distroseries')
         secret.nominatedarchindep = self.factory.makeDistroArchSeries(
             distroseries=secret)
         build = self.factory.makeSourcePackageRecipeBuild(

=== modified file 'lib/lp/code/tests/branch_helper.py'
--- lib/lp/code/tests/branch_helper.py	2011-12-08 21:15:07 +0000
+++ lib/lp/code/tests/branch_helper.py	2017-10-04 02:07:15 +0000
@@ -1,8 +1,10 @@
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Helper methods for branch tests and pagetest."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 __all__ = [
     'reset_all_branch_last_modified',

=== modified file 'lib/lp/code/tests/codeimporthelpers.py'
--- lib/lp/code/tests/codeimporthelpers.py	2015-10-19 10:56:16 +0000
+++ lib/lp/code/tests/codeimporthelpers.py	2017-10-04 02:07:15 +0000
@@ -1,8 +1,10 @@
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Helpers for Code Import page tests."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 __all__ = [
     'get_import_for_branch_name',

=== modified file 'lib/lp/code/tests/helpers.py'
--- lib/lp/code/tests/helpers.py	2017-05-19 15:50:01 +0000
+++ lib/lp/code/tests/helpers.py	2017-10-04 02:07:15 +0000
@@ -3,6 +3,8 @@
 
 """Helper functions for code testing live here."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 __all__ = [
     'add_revision_to_branch',
@@ -118,7 +120,7 @@
     # And fake a diff.
     naked_bmp = removeSecurityProxy(bmp)
     preview = removeSecurityProxy(naked_bmp.updatePreviewDiff(
-        ''.join(unified_diff('', 'random content')), u'rev-a', u'rev-b'))
+        ''.join(unified_diff('', 'random content')), 'rev-a', 'rev-b'))
     naked_bmp.source_branch.last_scanned_id = preview.source_revision_id
     naked_bmp.target_branch.last_scanned_id = preview.target_revision_id
     preview.diff_lines_count = 47
@@ -302,12 +304,12 @@
 class GitHostingFixture(fixtures.Fixture):
     """A fixture that temporarily registers a fake Git hosting client."""
 
-    def __init__(self, default_branch=u"refs/heads/master",
+    def __init__(self, default_branch="refs/heads/master",
                  refs=None, commits=None, log=None, diff=None, merge_diff=None,
                  merges=None, blob=None, disable_memcache=True):
         self.create = FakeMethod()
         self.getProperties = FakeMethod(
-            result={u"default_branch": default_branch})
+            result={"default_branch": default_branch})
         self.setProperties = FakeMethod()
         self.getRefs = FakeMethod(result=({} if refs is None else refs))
         self.getCommits = FakeMethod(

=== modified file 'lib/lp/code/tests/test_branch.py'
--- lib/lp/code/tests/test_branch.py	2012-09-28 06:15:58 +0000
+++ lib/lp/code/tests/test_branch.py	2017-10-04 02:07:15 +0000
@@ -1,8 +1,10 @@
-# Copyright 2009-2012 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Unit tests for methods of Branch and BranchSet."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 from zope.component import getUtility
 from zope.security.proxy import removeSecurityProxy
 

=== modified file 'lib/lp/code/tests/test_branch_access_policy_triggers.py'
--- lib/lp/code/tests/test_branch_access_policy_triggers.py	2013-06-20 05:50:00 +0000
+++ lib/lp/code/tests/test_branch_access_policy_triggers.py	2017-10-04 02:07:15 +0000
@@ -1,6 +1,8 @@
-# Copyright 2012 Canonical Ltd.  This software is licensed under the
+# Copyright 2012-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from zope.component import getUtility

=== modified file 'lib/lp/code/tests/test_branch_webservice.py'
--- lib/lp/code/tests/test_branch_webservice.py	2016-11-11 14:24:38 +0000
+++ lib/lp/code/tests/test_branch_webservice.py	2017-10-04 02:07:15 +0000
@@ -1,6 +1,8 @@
-# Copyright 2011-2016 Canonical Ltd.  This software is licensed under the
+# Copyright 2011-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from lazr.restfulclient.errors import BadRequest

=== modified file 'lib/lp/code/tests/test_branchmergeproposal.py'
--- lib/lp/code/tests/test_branchmergeproposal.py	2016-11-15 11:54:30 +0000
+++ lib/lp/code/tests/test_branchmergeproposal.py	2017-10-04 02:07:15 +0000
@@ -1,8 +1,9 @@
-# Copyright 2010 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Unit tests for methods of BranchMergeProposal."""
 
+from __future__ import absolute_import, print_function, unicode_literals
 
 from zope.component import getUtility
 from zope.security.proxy import removeSecurityProxy

=== modified file 'lib/lp/code/tests/test_branchurifield.py'
--- lib/lp/code/tests/test_branchurifield.py	2012-01-01 02:58:52 +0000
+++ lib/lp/code/tests/test_branchurifield.py	2017-10-04 02:07:15 +0000
@@ -1,8 +1,10 @@
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for BranchURIField."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from lp.app.validators import LaunchpadValidationError
@@ -49,13 +51,13 @@
         # Branches on the supermirror are already registered, so there is no
         # need to register them, again.
         self.assertInvalid(
-            u'%s/~user/+junk/branch' % config.codehosting.supermirror_root)
+            '%s/~user/+junk/branch' % config.codehosting.supermirror_root)
 
     def test_notFromLaunchpad(self):
         # URIs from Launchpad itself are invalid, no matter what the
         # subdomain.
         for domain in self.listLaunchpadDomains():
-            self.assertInvalid(u'http://%s/user/+junk/branch' % domain)
+            self.assertInvalid('http://%s/user/+junk/branch' % domain)
 
     def test_get_blacklisted_hostnames(self):
         self.pushConfig(
@@ -71,5 +73,5 @@
         # allowed to be registered.
         self.pushConfig(
             'codehosting', blacklisted_hostnames='localhost,127.0.0.1')
-        self.assertInvalid(u'http://localhost/foo/bar')
-        self.assertInvalid(u'http://127.0.0.1/foo/bar')
+        self.assertInvalid('http://localhost/foo/bar')
+        self.assertInvalid('http://127.0.0.1/foo/bar')

=== modified file 'lib/lp/code/tests/test_doc.py'
--- lib/lp/code/tests/test_doc.py	2015-09-02 16:54:24 +0000
+++ lib/lp/code/tests/test_doc.py	2017-10-04 02:07:15 +0000
@@ -1,10 +1,12 @@
-# Copyright 2009-2015 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """
 Run the doctests and pagetests.
 """
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 import os
 
 from zope.security.management import setSecurityPolicy

=== modified file 'lib/lp/code/tests/test_helpers.py'
--- lib/lp/code/tests/test_helpers.py	2012-01-01 02:58:52 +0000
+++ lib/lp/code/tests/test_helpers.py	2017-10-04 02:07:15 +0000
@@ -1,8 +1,10 @@
-# Copyright 2010 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test the code test helpers found in helpers.py."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from datetime import (

=== modified file 'lib/lp/code/tests/test_project.py'
--- lib/lp/code/tests/test_project.py	2015-01-29 14:14:01 +0000
+++ lib/lp/code/tests/test_project.py	2017-10-04 02:07:15 +0000
@@ -1,8 +1,10 @@
-# Copyright 2010 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for product views."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from lp.testing import TestCaseWithFactory

=== modified file 'lib/lp/code/tests/test_publisher.py'
--- lib/lp/code/tests/test_publisher.py	2012-01-01 02:58:52 +0000
+++ lib/lp/code/tests/test_publisher.py	2017-10-04 02:07:15 +0000
@@ -1,8 +1,10 @@
-# Copyright 2010 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for code's custom publications."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from lp.code.publisher import CodeLayer

=== modified file 'lib/lp/code/tests/test_seriessourcepackagebranch.py'
--- lib/lp/code/tests/test_seriessourcepackagebranch.py	2012-01-01 02:58:52 +0000
+++ lib/lp/code/tests/test_seriessourcepackagebranch.py	2017-10-04 02:07:15 +0000
@@ -1,8 +1,10 @@
-# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for ISeriesSourcePackageBranch."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from datetime import datetime

=== modified file 'lib/lp/code/tests/test_yuitests.py'
--- lib/lp/code/tests/test_yuitests.py	2012-01-01 02:58:52 +0000
+++ lib/lp/code/tests/test_yuitests.py	2017-10-04 02:07:15 +0000
@@ -1,8 +1,10 @@
-# Copyright 2010 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Run YUI.test tests."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 __all__ = []
 


Follow ups