← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/snappy-tests-future-imports into lp:launchpad.

Commit message:
Convert all tests under lp.snappy to Launchpad's preferred __future__ imports.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/snappy-tests-future-imports/+merge/332570
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/snappy-tests-future-imports into lp:launchpad.
=== modified file 'lib/lp/snappy/browser/tests/test_hassnaps.py'
--- lib/lp/snappy/browser/tests/test_hassnaps.py	2016-10-12 12:51:05 +0000
+++ lib/lp/snappy/browser/tests/test_hassnaps.py	2017-10-20 13:40:43 +0000
@@ -1,8 +1,10 @@
-# Copyright 2015-2016 Canonical Ltd.  This software is licensed under the
+# Copyright 2015-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test views for objects that have snap packages."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 import soupmatchers

=== modified file 'lib/lp/snappy/browser/tests/test_snap.py'
--- lib/lp/snappy/browser/tests/test_snap.py	2017-03-27 19:28:36 +0000
+++ lib/lp/snappy/browser/tests/test_snap.py	2017-10-20 13:40:43 +0000
@@ -3,6 +3,8 @@
 
 """Test snap package views."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from datetime import (
@@ -111,7 +113,7 @@
     def test_canonical_url(self):
         owner = self.factory.makePerson(name="person")
         snap = self.factory.makeSnap(
-            registrant=owner, owner=owner, name=u"snap")
+            registrant=owner, owner=owner, name="snap")
         self.assertEqual(
             "http://launchpad.dev/~person/+snap/snap";, canonical_url(snap))
 
@@ -324,7 +326,7 @@
             owner=self.person,
             information_type=InformationType.USERDATA)
 
-        with self.useFixture(FeatureFixture({SNAP_PRIVATE_FEATURE_FLAG: u""})):
+        with self.useFixture(FeatureFixture({SNAP_PRIVATE_FEATURE_FLAG: ""})):
             browser = self.getViewBrowser(branch, user=self.person)
             self.assertRaises(
                 LinkNotFoundError, browser.getLink, "Create snap package")
@@ -414,11 +416,11 @@
             redirection = self.assertRaises(
                 HTTPError, browser.getControl("Create snap package").click)
         login_person(self.person)
-        snap = getUtility(ISnapSet).getByName(self.person, u"snap-name")
+        snap = getUtility(ISnapSet).getByName(self.person, "snap-name")
         self.assertThat(snap, MatchesStructure.byEquality(
             owner=self.person, distro_series=self.distroseries,
-            name=u"snap-name", source=branch, store_upload=True,
-            store_series=self.snappyseries, store_name=u"store-name",
+            name="snap-name", source=branch, store_upload=True,
+            store_series=self.snappyseries, store_name="store-name",
             store_secrets={"root": root_macaroon_raw},
             store_channels=["track/edge"]))
         self.assertThat(self.request, MatchesStructure.byEquality(
@@ -482,7 +484,7 @@
         browser.getControl(name="field.name").value = "snap-name"
         browser.getControl("Create snap package").click()
         login_person(self.person)
-        snap = getUtility(ISnapSet).getByName(self.person, u"snap-name")
+        snap = getUtility(ISnapSet).getByName(self.person, "snap-name")
         self.assertContentEqual(
             ["386", "amd64"], [proc.name for proc in snap.processors])
 
@@ -724,16 +726,16 @@
             view.initialize()
             view.request_action.success({
                 "owner": snap.owner,
-                "name": u"changed",
+                "name": "changed",
                 "distro_series": snap.distro_series,
                 })
         self.assertSqlAttributeEqualsDate(snap, "date_last_modified", UTC_NOW)
 
     def test_edit_snap_already_exists(self):
         snap = self.factory.makeSnap(
-            registrant=self.person, owner=self.person, name=u"one")
+            registrant=self.person, owner=self.person, name="one")
         self.factory.makeSnap(
-            registrant=self.person, owner=self.person, name=u"two")
+            registrant=self.person, owner=self.person, name="two")
         browser = self.getViewBrowser(snap, user=self.person)
         browser.getLink("Edit snap package").click()
         browser.getControl(name="field.name").value = "two"
@@ -902,7 +904,7 @@
     def assertNeedStoreReauth(self, expected, initial_kwargs, data):
         initial_kwargs.setdefault("store_upload", True)
         initial_kwargs.setdefault("store_series", self.snappyseries)
-        initial_kwargs.setdefault("store_name", u"one")
+        initial_kwargs.setdefault("store_name", "one")
         snap = self.factory.makeSnap(
             registrant=self.person, owner=self.person,
             distroseries=self.distroseries, **initial_kwargs)
@@ -928,7 +930,7 @@
 
     def test__needStoreReauth_different_name(self):
         # Changing the store name requires reauthorization.
-        self.assertNeedStoreReauth(True, {}, {"store_name": u"two"})
+        self.assertNeedStoreReauth(True, {}, {"store_name": "two"})
 
     def test__needStoreReauth_enable_upload(self):
         # Enabling store upload requires reauthorization.  (This can happen
@@ -946,7 +948,7 @@
         snap = self.factory.makeSnap(
             registrant=self.person, owner=self.person,
             distroseries=self.distroseries, store_upload=True,
-            store_series=self.snappyseries, store_name=u"one",
+            store_series=self.snappyseries, store_name="one",
             store_channels=["track/edge"])
         view_url = canonical_url(snap, view_name="+edit")
         browser = self.getNonRedirectingBrowser(url=view_url, user=self.person)
@@ -975,7 +977,7 @@
                 HTTPError, browser.getControl("Update snap package").click)
         login_person(self.person)
         self.assertThat(snap, MatchesStructure.byEquality(
-            store_name=u"two", store_secrets={"root": root_macaroon_raw},
+            store_name="two", store_secrets={"root": root_macaroon_raw},
             store_channels=["stable", "edge"]))
         self.assertThat(self.request, MatchesStructure.byEquality(
             url="http://sca.example/dev/api/acl/";, method="POST"))
@@ -1165,7 +1167,7 @@
             kwargs["branch"] = self.factory.makeAnyBranch()
         return self.factory.makeSnap(
             registrant=self.person, owner=self.person,
-            distroseries=self.distroseries, name=u"snap-name", **kwargs)
+            distroseries=self.distroseries, name="snap-name", **kwargs)
 
     def makeBuild(self, snap=None, archive=None, date_created=None, **kwargs):
         if snap is None:
@@ -1232,8 +1234,8 @@
 
     def test_index_git(self):
         [ref] = self.factory.makeGitRefs(
-            owner=self.person, target=self.person, name=u"snap-repository",
-            paths=[u"refs/heads/master"])
+            owner=self.person, target=self.person, name="snap-repository",
+            paths=["refs/heads/master"])
         snap = self.makeSnap(git_ref=ref)
         build = self.makeBuild(
             snap=snap, status=BuildStatus.FULLYBUILT,
@@ -1259,8 +1261,8 @@
 
     def test_index_git_url(self):
         ref = self.factory.makeGitRefRemote(
-            repository_url=u"https://git.example.org/foo";,
-            path=u"refs/heads/master")
+            repository_url="https://git.example.org/foo";,
+            path="refs/heads/master")
         snap = self.makeSnap(git_ref=ref)
         build = self.makeBuild(
             snap=snap, status=BuildStatus.FULLYBUILT,
@@ -1331,7 +1333,7 @@
                 usable_distro_series=[self.distroseries])
         snap = self.makeSnap(
             store_upload=True, store_series=snappyseries,
-            store_name=self.getUniqueString(u"store-name"))
+            store_name=self.getUniqueString("store-name"))
         view = create_initialized_view(snap, "+index")
         store_upload_tag = soupmatchers.Tag(
             "store upload", "div", attrs={"id": "store_upload"})
@@ -1399,7 +1401,7 @@
             self.architectures.append(das)
         self.snap = self.factory.makeSnap(
             registrant=self.person, owner=self.person,
-            distroseries=self.distroseries, name=u"snap-name")
+            distroseries=self.distroseries, name="snap-name")
 
     def test_request_builds_page(self):
         # The +request-builds page is sane.

=== modified file 'lib/lp/snappy/browser/tests/test_snapbuild.py'
--- lib/lp/snappy/browser/tests/test_snapbuild.py	2017-04-03 12:35:03 +0000
+++ lib/lp/snappy/browser/tests/test_snapbuild.py	2017-10-20 13:40:43 +0000
@@ -3,6 +3,8 @@
 
 """Test snap package build views."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 import re
@@ -51,7 +53,7 @@
     def test_canonical_url(self):
         owner = self.factory.makePerson(name="person")
         snap = self.factory.makeSnap(
-            registrant=owner, owner=owner, name=u"snap")
+            registrant=owner, owner=owner, name="snap")
         build = self.factory.makeSnapBuild(requester=owner, snap=snap)
         self.assertThat(
             canonical_url(build),
@@ -243,9 +245,10 @@
         browser = self.getViewBrowser(
             self.build, "+rescore", user=self.buildd_admin)
         self.assertEqual(self.build_url, browser.url)
-        self.assertIn(
-            "Cannot rescore this build because it is not queued.",
-            browser.contents)
+        self.assertThat(browser.contents, soupmatchers.HTMLContains(
+            soupmatchers.Tag(
+                "notification", "div", attrs={"class": "warning message"},
+                text="Cannot rescore this build because it is not queued.")))
 
     def setUpStoreUpload(self):
         self.pushConfig(

=== modified file 'lib/lp/snappy/browser/tests/test_snaplisting.py'
--- lib/lp/snappy/browser/tests/test_snaplisting.py	2017-10-10 22:44:26 +0000
+++ lib/lp/snappy/browser/tests/test_snaplisting.py	2017-10-20 13:40:43 +0000
@@ -3,6 +3,8 @@
 
 """Test snap package listings."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from datetime import (

=== modified file 'lib/lp/snappy/browser/widgets/tests/test_snaparchivewidget.py'
--- lib/lp/snappy/browser/widgets/tests/test_snaparchivewidget.py	2016-07-13 08:47:42 +0000
+++ lib/lp/snappy/browser/widgets/tests/test_snaparchivewidget.py	2017-10-20 13:40:43 +0000
@@ -1,6 +1,8 @@
-# Copyright 2015-2016 Canonical Ltd.  This software is licensed under the
+# Copyright 2015-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
 
 import re
@@ -59,8 +61,7 @@
     def setUp(self):
         super(TestSnapArchiveWidget, self).setUp()
         self.distroseries = self.factory.makeDistroSeries()
-        field = Reference(
-            __name__="archive", schema=IArchive, title=u"Archive")
+        field = Reference(__name__="archive", schema=IArchive, title="Archive")
         self.context = self.context_factory(self)
         field = field.bind(self.context)
         request = LaunchpadTestRequest()

=== modified file 'lib/lp/snappy/browser/widgets/tests/test_storechannelswidget.py'
--- lib/lp/snappy/browser/widgets/tests/test_storechannelswidget.py	2017-03-27 19:28:36 +0000
+++ lib/lp/snappy/browser/widgets/tests/test_storechannelswidget.py	2017-10-20 13:40:43 +0000
@@ -1,6 +1,8 @@
 # Copyright 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
 
 import re
@@ -34,7 +36,7 @@
 
     def setUp(self):
         super(TestStoreChannelsWidget, self).setUp()
-        field = List(__name__="channels", title=u"Store channels")
+        field = List(__name__="channels", title="Store channels")
         self.context = self.factory.makeSnap()
         field = field.bind(self.context)
         request = LaunchpadTestRequest()

=== modified file 'lib/lp/snappy/tests/test_snap.py'
--- lib/lp/snappy/tests/test_snap.py	2017-08-22 11:36:30 +0000
+++ lib/lp/snappy/tests/test_snap.py	2017-10-20 13:40:43 +0000
@@ -3,6 +3,8 @@
 
 """Test snap packages."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from datetime import (
@@ -405,11 +407,11 @@
         distroseries = self.factory.makeDistroSeries()
         snap = self.factory.makeSnap(
             registrant=owner, owner=owner, distroseries=distroseries,
-            name=u"condemned")
-        self.assertTrue(getUtility(ISnapSet).exists(owner, u"condemned"))
+            name="condemned")
+        self.assertTrue(getUtility(ISnapSet).exists(owner, "condemned"))
         with person_logged_in(snap.owner):
             snap.destroySelf()
-        self.assertFalse(getUtility(ISnapSet).exists(owner, u"condemned"))
+        self.assertFalse(getUtility(ISnapSet).exists(owner, "condemned"))
 
     def test_getBuildSummariesForSnapBuildIds(self):
         snap1 = self.factory.makeSnap()
@@ -461,7 +463,7 @@
         summary = snap.getBuildSummariesForSnapBuildIds([build.id])
         self.assertIsNone(summary[build.id]["build_log_size"])
         removeSecurityProxy(build).log = self.factory.makeLibraryFileAlias(
-            content='x' * 12345, db_only=True)
+            content=b'x' * 12345, db_only=True)
         summary = snap.getBuildSummariesForSnapBuildIds([build.id])
         self.assertEqual(12345, summary[build.id]["build_log_size"])
 
@@ -497,12 +499,12 @@
         distroseries = self.factory.makeDistroSeries()
         snap = self.factory.makeSnap(
             registrant=owner, owner=owner, distroseries=distroseries,
-            name=u"condemned")
+            name="condemned")
         build = self.factory.makeSnapBuild(snap=snap)
         build_queue = build.queueBuild()
         snapfile = self.factory.makeSnapFile(snapbuild=build)
         snap_build_job = getUtility(ISnapStoreUploadJobSource).create(build)
-        self.assertTrue(getUtility(ISnapSet).exists(owner, u"condemned"))
+        self.assertTrue(getUtility(ISnapSet).exists(owner, "condemned"))
         other_build = self.factory.makeSnapBuild()
         other_build.queueBuild()
         store = Store.of(build)
@@ -516,7 +518,7 @@
             snap.destroySelf()
         flush_database_caches()
         # The deleted snap and its builds are gone.
-        self.assertFalse(getUtility(ISnapSet).exists(owner, u"condemned"))
+        self.assertFalse(getUtility(ISnapSet).exists(owner, "condemned"))
         self.assertIsNone(getUtility(ISnapBuildSet).getByID(build_id))
         self.assertIsNone(store.get(BuildQueue, build_queue_id))
         self.assertIsNone(store.get(BuildFarmJob, build_farm_job_id))
@@ -564,7 +566,7 @@
             registrant=registrant,
             owner=self.factory.makeTeam(owner=registrant),
             distro_series=self.factory.makeDistroSeries(),
-            name=self.factory.getUniqueString(u"snap-name"))
+            name=self.factory.getUniqueUnicode("snap-name"))
         if branch is None and git_ref is None:
             branch = self.factory.makeAnyBranch()
         if branch is not None:
@@ -645,7 +647,7 @@
                 owner=owner,
                 git_ref=git_ref,
                 distro_series=self.factory.makeDistroSeries(),
-                name=self.factory.getUniqueString(u"snap-name"),
+                name=self.factory.getUniqueUnicode("snap-name"),
             )
             self.assertRaises(
                 SnapPrivacyMismatch, getUtility(ISnapSet).new, **components)
@@ -661,7 +663,7 @@
                 owner=owner,
                 branch=branch,
                 distro_series=self.factory.makeDistroSeries(),
-                name=self.factory.getUniqueString(u"snap-name"),
+                name=self.factory.getUniqueUnicode("snap-name"),
             )
             self.assertRaises(
                 SnapPrivacyMismatch, getUtility(ISnapSet).new, **components)
@@ -678,7 +680,7 @@
                 owner=private_team,
                 git_ref=git_ref,
                 distro_series=self.factory.makeDistroSeries(),
-                name=self.factory.getUniqueString(u"snap-name"),
+                name=self.factory.getUniqueUnicode("snap-name"),
             )
             self.assertRaises(
                 SnapPrivacyMismatch, getUtility(ISnapSet).new, **components)
@@ -690,7 +692,7 @@
         self.assertRaises(
             NoSourceForSnap, getUtility(ISnapSet).new,
             registrant, registrant, self.factory.makeDistroSeries(),
-            self.factory.getUniqueString(u"snap-name"))
+            self.factory.getUniqueUnicode("snap-name"))
 
     def test_exists(self):
         # ISnapSet.exists checks for matching Snaps.
@@ -698,7 +700,7 @@
         self.assertTrue(getUtility(ISnapSet).exists(snap.owner, snap.name))
         self.assertFalse(
             getUtility(ISnapSet).exists(self.factory.makePerson(), snap.name))
-        self.assertFalse(getUtility(ISnapSet).exists(snap.owner, u"different"))
+        self.assertFalse(getUtility(ISnapSet).exists(snap.owner, "different"))
 
     def test_findByOwner(self):
         # ISnapSet.findByOwner returns all Snaps with the given owner.
@@ -801,7 +803,7 @@
         snaps = []
         for repository in repositories:
             refs.extend(self.factory.makeGitRefs(
-                paths=[u"refs/heads/master", u"refs/heads/other"]))
+                paths=["refs/heads/master", "refs/heads/other"]))
             snaps.append(self.factory.makeSnap(git_ref=refs[-2]))
             snaps.append(self.factory.makeSnap(git_ref=refs[-1]))
         snap_set = getUtility(ISnapSet)
@@ -817,7 +819,7 @@
         repository = self.factory.makeGitRepository(target=project)
         refs = self.factory.makeGitRefs(
             repository=repository,
-            paths=[u"refs/heads/master", u"refs/heads/other"])
+            paths=["refs/heads/master", "refs/heads/other"])
         snaps = []
         snaps.append(self.factory.makeSnap(branch=branch))
         snaps.append(self.factory.makeSnap(branch=other_branch))
@@ -839,7 +841,7 @@
 
     def test_findByURL(self):
         # ISnapSet.findByURL returns visible Snaps with the given URL.
-        urls = [u"https://git.example.org/foo";, u"https://git.example.org/bar";]
+        urls = ["https://git.example.org/foo";, "https://git.example.org/bar";]
         owners = [self.factory.makePerson() for i in range(2)]
         snaps = []
         for url in urls:
@@ -861,9 +863,9 @@
         # ISnapSet.findByURLPrefix returns visible Snaps with the given URL
         # prefix.
         urls = [
-            u"https://git.example.org/foo/a";,
-            u"https://git.example.org/foo/b";,
-            u"https://git.example.org/bar";,
+            "https://git.example.org/foo/a";,
+            "https://git.example.org/foo/b";,
+            "https://git.example.org/bar";,
             ]
         owners = [self.factory.makePerson() for i in range(2)]
         snaps = []
@@ -876,7 +878,7 @@
             self.factory.makeSnap(branch=self.factory.makeAnyBranch()))
         snaps.append(
             self.factory.makeSnap(git_ref=self.factory.makeGitRefs()[0]))
-        prefix = u"https://git.example.org/foo/";
+        prefix = "https://git.example.org/foo/";
         self.assertContentEqual(
             snaps[:4], getUtility(ISnapSet).findByURLPrefix(prefix))
         self.assertContentEqual(
@@ -887,11 +889,11 @@
         # ISnapSet.findByURLPrefixes returns visible Snaps with any of the
         # given URL prefixes.
         urls = [
-            u"https://git.example.org/foo/a";,
-            u"https://git.example.org/foo/b";,
-            u"https://git.example.org/bar/a";,
-            u"https://git.example.org/bar/b";,
-            u"https://git.example.org/baz";,
+            "https://git.example.org/foo/a";,
+            "https://git.example.org/foo/b";,
+            "https://git.example.org/bar/a";,
+            "https://git.example.org/bar/b";,
+            "https://git.example.org/baz";,
             ]
         owners = [self.factory.makePerson() for i in range(2)]
         snaps = []
@@ -905,7 +907,7 @@
         snaps.append(
             self.factory.makeSnap(git_ref=self.factory.makeGitRefs()[0]))
         prefixes = [
-            u"https://git.example.org/foo/";, u"https://git.example.org/bar/";]
+            "https://git.example.org/foo/";, "https://git.example.org/bar/";]
         self.assertContentEqual(
             snaps[:8], getUtility(ISnapSet).findByURLPrefixes(prefixes))
         self.assertContentEqual(
@@ -1120,7 +1122,7 @@
         owner = self.factory.makePerson()
         snap = getUtility(ISnapSet).new(
             registrant=owner, owner=owner,
-            distro_series=self.factory.makeDistroSeries(), name=u"snap",
+            distro_series=self.factory.makeDistroSeries(), name="snap",
             branch=self.factory.makeAnyBranch())
         self.assertContentEqual(
             ["386", "amd64", "hppa", "default"],
@@ -1131,7 +1133,7 @@
         owner = self.factory.makePerson()
         snap = getUtility(ISnapSet).new(
             registrant=owner, owner=owner,
-            distro_series=self.factory.makeDistroSeries(), name=u"snap",
+            distro_series=self.factory.makeDistroSeries(), name="snap",
             branch=self.factory.makeAnyBranch(), processors=[self.arm])
         self.assertContentEqual(
             ["arm"], [processor.name for processor in snap.processors])
@@ -1381,7 +1383,7 @@
     def test_set_git_path(self):
         # Setting git_path on a Git-based Snap works.
         ref_master, ref_next = self.factory.makeGitRefs(
-            paths=[u"refs/heads/master", u"refs/heads/next"])
+            paths=["refs/heads/master", "refs/heads/next"])
         snap = self.makeSnap(git_ref=ref_master)
         response = self.webservice.patch(
             snap["self_link"], "application/json",
@@ -1434,7 +1436,7 @@
     def test_findByURL(self):
         # lp.snaps.findByURL returns visible Snaps with the given URL.
         persons = [self.factory.makePerson(), self.factory.makePerson()]
-        urls = [u"https://git.example.org/foo";, u"https://git.example.org/bar";]
+        urls = ["https://git.example.org/foo";, "https://git.example.org/bar";]
         snaps = []
         for url in urls:
             for person in persons:
@@ -1506,9 +1508,9 @@
         self.pushConfig("launchpad", default_batch_size=10)
         persons = [self.factory.makePerson(), self.factory.makePerson()]
         urls = [
-            u"https://git.example.org/foo/a";,
-            u"https://git.example.org/foo/b";,
-            u"https://git.example.org/bar";,
+            "https://git.example.org/foo/a";,
+            "https://git.example.org/foo/b";,
+            "https://git.example.org/bar";,
             ]
         snaps = []
         for url in urls:
@@ -1526,7 +1528,7 @@
         commercial_admin = (
             getUtility(ILaunchpadCelebrities).commercial_admin.teamowner)
         logout()
-        prefix = u"https://git.example.org/foo/";
+        prefix = "https://git.example.org/foo/";
         # Anonymous requests can only see public snaps.
         anon_webservice = LaunchpadWebServiceCaller("test", "")
         response = anon_webservice.named_get(
@@ -1585,11 +1587,11 @@
         self.pushConfig("launchpad", default_batch_size=20)
         persons = [self.factory.makePerson(), self.factory.makePerson()]
         urls = [
-            u"https://git.example.org/foo/a";,
-            u"https://git.example.org/foo/b";,
-            u"https://git.example.org/bar/a";,
-            u"https://git.example.org/bar/b";,
-            u"https://git.example.org/baz";,
+            "https://git.example.org/foo/a";,
+            "https://git.example.org/foo/b";,
+            "https://git.example.org/bar/a";,
+            "https://git.example.org/bar/b";,
+            "https://git.example.org/baz";,
             ]
         snaps = []
         for url in urls:
@@ -1608,7 +1610,7 @@
             getUtility(ILaunchpadCelebrities).commercial_admin.teamowner)
         logout()
         prefixes = [
-            u"https://git.example.org/foo/";, u"https://git.example.org/bar/";]
+            "https://git.example.org/foo/";, "https://git.example.org/bar/";]
         # Anonymous requests can only see public snaps.
         anon_webservice = LaunchpadWebServiceCaller("test", "")
         response = anon_webservice.named_get(

=== modified file 'lib/lp/snappy/tests/test_snapbuild.py'
--- lib/lp/snappy/tests/test_snapbuild.py	2017-04-03 12:35:03 +0000
+++ lib/lp/snappy/tests/test_snapbuild.py	2017-10-20 13:40:43 +0000
@@ -3,6 +3,8 @@
 
 """Test snap package build features."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from datetime import (
@@ -292,7 +294,7 @@
             distroseries=distroseries, architecturetag="i386",
             processor=processor)
         build = self.factory.makeSnapBuild(
-            name=u"snap-1", requester=person, owner=person,
+            name="snap-1", requester=person, owner=person,
             distroarchseries=distroarchseries,
             date_created=datetime(2014, 4, 25, 10, 38, 0, tzinfo=pytz.UTC),
             status=BuildStatus.FAILEDTOBUILD,

=== modified file 'lib/lp/snappy/tests/test_snapbuildbehaviour.py'
--- lib/lp/snappy/tests/test_snapbuildbehaviour.py	2017-07-25 18:01:04 +0000
+++ lib/lp/snappy/tests/test_snapbuildbehaviour.py	2017-10-20 13:40:43 +0000
@@ -3,6 +3,8 @@
 
 """Test snap package build behaviour."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 import base64
@@ -90,7 +92,7 @@
             processor=processor)
         build = self.factory.makeSnapBuild(
             archive=archive, distroarchseries=distroarchseries, pocket=pocket,
-            name=u"test-snap", **kwargs)
+            name="test-snap", **kwargs)
         return IBuildFarmJobBehaviour(build)
 
 
@@ -246,14 +248,14 @@
                     Equals(config.snappy.builder_proxy_auth_api_endpoint),
                     ]),
                 MatchesDict({
-                    "method": Equals("POST"),
+                    "method": Equals(b"POST"),
                     "postdata": AfterPreprocessing(json.loads, MatchesDict({
                         "username": StartsWith(job.build.build_cookie + "-"),
                         })),
                     "headers": MatchesDict({
-                        "Authorization": Equals("Basic " + base64.b64encode(
-                            "admin-launchpad.dev:admin-secret")),
-                        "Content-Type": Equals("application/json"),
+                        b"Authorization": Equals(b"Basic " + base64.b64encode(
+                            b"admin-launchpad.dev:admin-secret")),
+                        b"Content-Type": Equals(b"application/json"),
                         }),
                     }),
                 ]),
@@ -274,7 +276,7 @@
             "archives": expected_archives,
             "arch_tag": "i386",
             "branch": branch.bzr_identity,
-            "name": u"test-snap",
+            "name": "test-snap",
             "proxy_url": self.proxy_url,
             "revocation_endpoint": self.revocation_endpoint,
             "series": "unstable",
@@ -297,7 +299,7 @@
             "arch_tag": "i386",
             "git_repository": ref.repository.git_https_url,
             "git_path": ref.name,
-            "name": u"test-snap",
+            "name": "test-snap",
             "proxy_url": self.proxy_url,
             "revocation_endpoint": self.revocation_endpoint,
             "series": "unstable",
@@ -310,7 +312,7 @@
         # job for the default branch in a Launchpad-hosted Git repository.
         [ref] = self.factory.makeGitRefs()
         removeSecurityProxy(ref.repository)._default_branch = ref.path
-        job = self.makeJob(git_ref=ref.repository.getRefByPath(u"HEAD"))
+        job = self.makeJob(git_ref=ref.repository.getRefByPath("HEAD"))
         expected_archives, expected_trusted_keys = (
             yield get_sources_list_for_building(
                 job.build, job.build.distro_arch_series, None))
@@ -320,7 +322,7 @@
             "archives": expected_archives,
             "arch_tag": "i386",
             "git_repository": ref.repository.git_https_url,
-            "name": u"test-snap",
+            "name": "test-snap",
             "proxy_url": self.proxy_url,
             "revocation_endpoint": self.revocation_endpoint,
             "series": "unstable",
@@ -331,9 +333,9 @@
     def test_extraBuildArgs_git_url(self):
         # _extraBuildArgs returns appropriate arguments if asked to build a
         # job for a Git branch backed by a URL for an external repository.
-        url = u"https://git.example.org/foo";
+        url = "https://git.example.org/foo";
         ref = self.factory.makeGitRefRemote(
-            repository_url=url, path=u"refs/heads/master")
+            repository_url=url, path="refs/heads/master")
         job = self.makeJob(git_ref=ref)
         expected_archives, expected_trusted_keys = (
             yield get_sources_list_for_building(
@@ -345,7 +347,7 @@
             "arch_tag": "i386",
             "git_repository": url,
             "git_path": "master",
-            "name": u"test-snap",
+            "name": "test-snap",
             "proxy_url": self.proxy_url,
             "revocation_endpoint": self.revocation_endpoint,
             "series": "unstable",
@@ -356,8 +358,8 @@
     def test_extraBuildArgs_git_url_HEAD(self):
         # _extraBuildArgs returns appropriate arguments if asked to build a
         # job for the default branch in an external Git repository.
-        url = u"https://git.example.org/foo";
-        ref = self.factory.makeGitRefRemote(repository_url=url, path=u"HEAD")
+        url = "https://git.example.org/foo";
+        ref = self.factory.makeGitRefRemote(repository_url=url, path="HEAD")
         job = self.makeJob(git_ref=ref)
         expected_archives, expected_trusted_keys = (
             yield get_sources_list_for_building(
@@ -368,7 +370,7 @@
             "archives": expected_archives,
             "arch_tag": "i386",
             "git_repository": url,
-            "name": u"test-snap",
+            "name": "test-snap",
             "proxy_url": self.proxy_url,
             "revocation_endpoint": self.revocation_endpoint,
             "series": "unstable",

=== modified file 'lib/lp/snappy/tests/test_yuitests.py'
--- lib/lp/snappy/tests/test_yuitests.py	2015-09-04 16:20:26 +0000
+++ lib/lp/snappy/tests/test_yuitests.py	2017-10-20 13:40:43 +0000
@@ -1,8 +1,10 @@
-# 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).
 
 """Run YUI.test tests."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 __all__ = []
 

=== modified file 'lib/lp/snappy/validators/tests/test_channels.py'
--- lib/lp/snappy/validators/tests/test_channels.py	2017-03-27 19:28:36 +0000
+++ lib/lp/snappy/validators/tests/test_channels.py	2017-10-20 13:40:43 +0000
@@ -1,6 +1,8 @@
 # Copyright 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 lp.app.validators import LaunchpadValidationError


Follow ups