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

Commit message:
Convert lp.soyuz.tests to Launchpad's preferred __future__ imports.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/soyuz-tests-future-imports/+merge/337042

Long but boring.  The only wart was needing to fix a couple of type(foo) == str 
checks.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
lp:~cjwatson/launchpad/soyuz-tests-future-imports into lp:launchpad.
=== modified file 'lib/lp/soyuz/tests/fakepackager.py'
--- lib/lp/soyuz/tests/fakepackager.py	2017-07-31 11:45:32 +0000
+++ lib/lp/soyuz/tests/fakepackager.py	2018-02-02 10:33:11 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """FakePackager utility.
@@ -7,6 +7,8 @@
 suite.
 """
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 __all__ = ['FakePackager']
 

=== modified file 'lib/lp/soyuz/tests/soyuz.py'
--- lib/lp/soyuz/tests/soyuz.py	2017-06-14 02:44:33 +0000
+++ lib/lp/soyuz/tests/soyuz.py	2018-02-02 10:33:11 +0000
@@ -1,8 +1,10 @@
-# Copyright 2009-2017 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Helper functions/classes for Soyuz tests."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 __all__ = [

=== modified file 'lib/lp/soyuz/tests/test_archive.py'
--- lib/lp/soyuz/tests/test_archive.py	2017-04-29 23:51:28 +0000
+++ lib/lp/soyuz/tests/test_archive.py	2018-02-02 10:33:11 +0000
@@ -1,8 +1,10 @@
-# Copyright 2009-2017 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test Archive features."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 from datetime import (
     date,
     datetime,
@@ -12,6 +14,7 @@
 import os.path
 
 from pytz import UTC
+import six
 from testtools.deferredruntest import AsynchronousDeferredRunTest
 from testtools.matchers import (
     AllMatch,
@@ -1272,15 +1275,15 @@
     def test_feature_flag_disabled(self):
         # With feature flag disabled, we will not create new named auth tokens.
         private_ppa = self.factory.makeArchive(private=True)
-        with FeatureFixture({NAMED_AUTH_TOKEN_FEATURE_FLAG: u""}):
+        with FeatureFixture({NAMED_AUTH_TOKEN_FEATURE_FLAG: ""}):
             self.assertRaises(NamedAuthTokenFeatureDisabled,
-                              private_ppa.newNamedAuthToken, u"tokenname")
+                              private_ppa.newNamedAuthToken, "tokenname")
 
     def test_feature_flag_disabled_by_default(self):
          # Without a feature flag, we will not create new named auth tokens.
         private_ppa = self.factory.makeArchive(private=True)
         self.assertRaises(NamedAuthTokenFeatureDisabled,
-            private_ppa.newNamedAuthToken, u"tokenname")
+            private_ppa.newNamedAuthToken, "tokenname")
 
 
 class TestArchiveTokens(TestCaseWithFactory):
@@ -1292,7 +1295,7 @@
         self.private_ppa = self.factory.makeArchive(owner=owner, private=True)
         self.joe = self.factory.makePerson(name='joe')
         self.private_ppa.newSubscription(self.joe, owner)
-        self.useFixture(FeatureFixture({NAMED_AUTH_TOKEN_FEATURE_FLAG: u"on"}))
+        self.useFixture(FeatureFixture({NAMED_AUTH_TOKEN_FEATURE_FLAG: "on"}))
 
     def test_getAuthToken_with_no_token(self):
         self.assertIsNone(self.private_ppa.getAuthToken(self.joe))
@@ -1308,8 +1311,8 @@
         self.assertEqual(token.archive_url, url)
 
     def test_newNamedAuthToken_private_archive(self):
-        res = self.private_ppa.newNamedAuthToken(u"tokenname", as_dict=True)
-        token = self.private_ppa.getNamedAuthToken(u"tokenname")
+        res = self.private_ppa.newNamedAuthToken("tokenname", as_dict=True)
+        token = self.private_ppa.getNamedAuthToken("tokenname")
         self.assertIsNotNone(token)
         self.assertIsNone(token.person)
         self.assertEqual("tokenname", token.name)
@@ -1325,37 +1328,37 @@
     def test_newNamedAuthToken_public_archive(self):
         public_ppa = self.factory.makeArchive(private=False)
         self.assertRaises(ArchiveNotPrivate,
-            public_ppa.newNamedAuthToken, u"tokenname")
+            public_ppa.newNamedAuthToken, "tokenname")
 
     def test_newNamedAuthToken_duplicate_name(self):
-        self.private_ppa.newNamedAuthToken(u"tokenname")
+        self.private_ppa.newNamedAuthToken("tokenname")
         self.assertRaises(DuplicateTokenName,
-            self.private_ppa.newNamedAuthToken, u"tokenname")
+            self.private_ppa.newNamedAuthToken, "tokenname")
 
     def test_newNamedAuthToken_with_custom_secret(self):
-        token = self.private_ppa.newNamedAuthToken(u"tokenname", u"secret")
-        self.assertEqual(u"secret", token.token)
+        token = self.private_ppa.newNamedAuthToken("tokenname", "secret")
+        self.assertEqual("secret", token.token)
 
     def test_newNamedAuthTokens_private_archive(self):
         res = self.private_ppa.newNamedAuthTokens(
-            (u"name1", u"name2"), as_dict=True)
+            ("name1", "name2"), as_dict=True)
         tokens = self.private_ppa.getNamedAuthTokens()
         self.assertDictEqual({tok.name: tok.asDict() for tok in tokens}, res)
 
     def test_newNamedAuthTokens_public_archive(self):
         public_ppa = self.factory.makeArchive(private=False)
         self.assertRaises(ArchiveNotPrivate,
-            public_ppa.newNamedAuthTokens, (u"name1", u"name2"))
+            public_ppa.newNamedAuthTokens, ("name1", "name2"))
 
     def test_newNamedAuthTokens_duplicate_name(self):
-        self.private_ppa.newNamedAuthToken(u"tok1")
+        self.private_ppa.newNamedAuthToken("tok1")
         res = self.private_ppa.newNamedAuthTokens(
-            (u"tok1", u"tok2", u"tok3"), as_dict=True)
+            ("tok1", "tok2", "tok3"), as_dict=True)
         tokens = self.private_ppa.getNamedAuthTokens()
         self.assertDictEqual({tok.name: tok.asDict() for tok in tokens}, res)
 
     def test_newNamedAuthTokens_idempotent(self):
-        names = (u"name1", u"name2", u"name3", u"name4", u"name5")
+        names = ("name1", "name2", "name3", "name4", "name5")
         res1 = self.private_ppa.newNamedAuthTokens(names, as_dict=True)
         res2 = self.private_ppa.newNamedAuthTokens(names, as_dict=True)
         self.assertEqual(res1, res2)
@@ -1364,32 +1367,32 @@
         # Preload feature flag so it is cached.
         getFeatureFlag(NAMED_AUTH_TOKEN_FEATURE_FLAG)
         with StormStatementRecorder() as recorder1:
-            self.private_ppa.newNamedAuthTokens((u"tok1"))
+            self.private_ppa.newNamedAuthTokens(("tok1"))
         with StormStatementRecorder() as recorder2:
-            self.private_ppa.newNamedAuthTokens((u"tok1", u"tok2", u"tok3"))
+            self.private_ppa.newNamedAuthTokens(("tok1", "tok2", "tok3"))
         self.assertThat(recorder2, HasQueryCount.byEquality(recorder1))
 
     def test_getNamedAuthToken_with_no_token(self):
         self.assertRaises(
-            NotFoundError, self.private_ppa.getNamedAuthToken, u"tokenname")
+            NotFoundError, self.private_ppa.getNamedAuthToken, "tokenname")
 
     def test_getNamedAuthToken_with_token(self):
-        res = self.private_ppa.newNamedAuthToken(u"tokenname", as_dict=True)
+        res = self.private_ppa.newNamedAuthToken("tokenname", as_dict=True)
         self.assertEqual(
-            self.private_ppa.getNamedAuthToken(u"tokenname", as_dict=True),
+            self.private_ppa.getNamedAuthToken("tokenname", as_dict=True),
             res)
 
     def test_revokeNamedAuthToken_with_token(self):
-        token = self.private_ppa.newNamedAuthToken(u"tokenname")
-        self.private_ppa.revokeNamedAuthToken(u"tokenname")
+        token = self.private_ppa.newNamedAuthToken("tokenname")
+        self.private_ppa.revokeNamedAuthToken("tokenname")
         self.assertIsNotNone(token.date_deactivated)
 
     def test_revokeNamedAuthToken_with_no_token(self):
         self.assertRaises(
-            NotFoundError, self.private_ppa.revokeNamedAuthToken, u"tokenname")
+            NotFoundError, self.private_ppa.revokeNamedAuthToken, "tokenname")
 
     def test_revokeNamedAuthTokens(self):
-        names = (u"name1", u"name2", u"name3", u"name4", u"name5")
+        names = ("name1", "name2", "name3", "name4", "name5")
         tokens = self.private_ppa.newNamedAuthTokens(names)
         self.assertThat(
             tokens, AllMatch(MatchesPredicate(
@@ -1400,10 +1403,10 @@
                 lambda x: x.date_deactivated, '%s is active.')))
 
     def test_revokeNamedAuthTokens_with_previously_revoked_token(self):
-        names = (u"name1", u"name2", u"name3", u"name4", u"name5")
+        names = ("name1", "name2", "name3", "name4", "name5")
         self.private_ppa.newNamedAuthTokens(names)
-        token1 = self.private_ppa.getNamedAuthToken(u"name1")
-        token2 = self.private_ppa.getNamedAuthToken(u"name2")
+        token1 = self.private_ppa.getNamedAuthToken("name1")
+        token2 = self.private_ppa.getNamedAuthToken("name2")
 
         # Revoke token1.
         deactivation_time_1 = datetime.now(UTC) - timedelta(seconds=90)
@@ -1417,34 +1420,34 @@
         self.assertLess(token1.date_deactivated, token2.date_deactivated)
 
     def test_revokeNamedAuthTokens_idempotent(self):
-        names = (u"name1", u"name2", u"name3", u"name4", u"name5")
+        names = ("name1", "name2", "name3", "name4", "name5")
         res1 = self.private_ppa.revokeNamedAuthTokens(names)
         res2 = self.private_ppa.revokeNamedAuthTokens(names)
         self.assertEqual(res1, res2)
 
     def test_getNamedAuthToken_with_revoked_token(self):
-        self.private_ppa.newNamedAuthToken(u"tokenname")
-        self.private_ppa.revokeNamedAuthToken(u"tokenname")
+        self.private_ppa.newNamedAuthToken("tokenname")
+        self.private_ppa.revokeNamedAuthToken("tokenname")
         self.assertRaises(
-            NotFoundError, self.private_ppa.getNamedAuthToken, u"tokenname")
+            NotFoundError, self.private_ppa.getNamedAuthToken, "tokenname")
 
     def test_getNamedAuthTokens(self):
-        res1 = self.private_ppa.newNamedAuthToken(u"tokenname1", as_dict=True)
-        res2 = self.private_ppa.newNamedAuthToken(u"tokenname2", as_dict=True)
-        self.private_ppa.newNamedAuthToken(u"tokenname3")
-        self.private_ppa.revokeNamedAuthToken(u"tokenname3")
+        res1 = self.private_ppa.newNamedAuthToken("tokenname1", as_dict=True)
+        res2 = self.private_ppa.newNamedAuthToken("tokenname2", as_dict=True)
+        self.private_ppa.newNamedAuthToken("tokenname3")
+        self.private_ppa.revokeNamedAuthToken("tokenname3")
         self.assertContentEqual(
             [res1, res2],
             self.private_ppa.getNamedAuthTokens(as_dict=True))
 
     def test_getNamedAuthTokens_with_names(self):
-        res1 = self.private_ppa.newNamedAuthToken(u"tokenname1", as_dict=True)
-        res2 = self.private_ppa.newNamedAuthToken(u"tokenname2", as_dict=True)
-        self.private_ppa.newNamedAuthToken(u"tokenname3")
+        res1 = self.private_ppa.newNamedAuthToken("tokenname1", as_dict=True)
+        res2 = self.private_ppa.newNamedAuthToken("tokenname2", as_dict=True)
+        self.private_ppa.newNamedAuthToken("tokenname3")
         self.assertContentEqual(
             [res1, res2],
             self.private_ppa.getNamedAuthTokens(
-                (u"tokenname1", u"tokenname2"), as_dict=True))
+                ("tokenname1", "tokenname2"), as_dict=True))
 
 
 class TestGetBinaryPackageRelease(TestCaseWithFactory):
@@ -1970,14 +1973,14 @@
     def _createDep(self, test_publisher, derived_series, parent_series,
                    parent_distro, component_name=None, pocket=None,
                    overlay=True, arch_tag='i386',
-                   publish_base_url=u'http://archive.launchpad.dev/'):
+                   publish_base_url='http://archive.launchpad.dev/'):
         # Helper to create a parent/child relationship.
-        if type(parent_distro) == str:
+        if isinstance(parent_distro, six.string_types):
             depdistro = self.factory.makeDistribution(parent_distro,
                 publish_base_url=publish_base_url)
         else:
             depdistro = parent_distro
-        if type(parent_series) == str:
+        if isinstance(parent_series, six.string_types):
             depseries = self.factory.makeDistroSeries(
                 name=parent_series, distribution=depdistro)
             self.factory.makeDistroArchSeries(
@@ -2454,20 +2457,20 @@
             found.append((title, pub_ds))
         self.assertEqual(expected, found)
         self.assertEqual(1,
-            cprov_archive.getPublishedSources(name=u'cd').count())
+            cprov_archive.getPublishedSources(name='cd').count())
         self.assertEqual(1,
-            cprov_archive.getPublishedSources(name=u'ice').count())
+            cprov_archive.getPublishedSources(name='ice').count())
         self.assertEqual(1, cprov_archive.getPublishedSources(
-            name=u'iceweasel', exact_match=True).count())
+            name='iceweasel', exact_match=True).count())
         self.assertEqual(0, cprov_archive.getPublishedSources(
-            name=u'ice', exact_match=True).count())
+            name='ice', exact_match=True).count())
         self.assertRaises(VersionRequiresName,
             cprov_archive.getPublishedSources,
             version='1.0')
         self.assertEqual(1, cprov_archive.getPublishedSources(
-            name=u'ice', version='1.0').count())
+            name='ice', version='1.0').count())
         self.assertEqual(0, cprov_archive.getPublishedSources(
-            name=u'ice', version='666').count())
+            name='ice', version='666').count())
         self.assertEqual(3, cprov_archive.getPublishedSources(
             status=PackagePublishingStatus.PUBLISHED).count())
         self.assertEqual(3, cprov_archive.getPublishedSources(
@@ -2487,9 +2490,9 @@
             distroseries=warty,
             pocket=PackagePublishingPocket.UPDATES).count())
         self.assertEqual(1, cprov_archive.getPublishedSources(
-            name=u'ice', distroseries=warty).count())
+            name='ice', distroseries=warty).count())
         self.assertEqual(0, cprov_archive.getPublishedSources(
-            name=u'ice', distroseries=breezy_autotest).count())
+            name='ice', distroseries=breezy_autotest).count())
         mid_2007 = datetime(year=2007, month=7, day=9, hour=14, tzinfo=UTC)
         self.assertEqual(0, cprov_archive.getPublishedSources(
             created_since_date=mid_2007).count())
@@ -3383,7 +3386,7 @@
         self.assertIs(
             None,
             self.set.getPPAOwnedByPerson(
-                archive.owner, archive.distribution, archive.name + u'lol'))
+                archive.owner, archive.distribution, archive.name + 'lol'))
         self.assertIs(
             None,
             self.set.getPPAOwnedByPerson(

=== modified file 'lib/lp/soyuz/tests/test_archive_agent.py'
--- lib/lp/soyuz/tests/test_archive_agent.py	2014-03-11 07:08:33 +0000
+++ lib/lp/soyuz/tests/test_archive_agent.py	2018-02-02 10:33:11 +0000
@@ -1,8 +1,10 @@
-# Copyright 2010-2012 Canonical Ltd.  This software is licensed under the GNU
+# Copyright 2010-2018 Canonical Ltd.  This software is licensed under the GNU
 # Affero General Public License version 3 (see the file LICENSE).
 
 """Test Archive software center agent celebrity."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 from zope.component import getUtility
 from zope.security.interfaces import Unauthorized
 

=== modified file 'lib/lp/soyuz/tests/test_archive_privacy.py'
--- lib/lp/soyuz/tests/test_archive_privacy.py	2013-05-10 05:30:11 +0000
+++ lib/lp/soyuz/tests/test_archive_privacy.py	2018-02-02 10:33:11 +0000
@@ -1,8 +1,10 @@
-# Copyright 2010 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test Archive privacy features."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 from zope.security.interfaces import Unauthorized
 
 from lp.soyuz.interfaces.archive import CannotSwitchPrivacy

=== modified file 'lib/lp/soyuz/tests/test_archive_subscriptions.py'
--- lib/lp/soyuz/tests/test_archive_subscriptions.py	2016-03-17 23:40:28 +0000
+++ lib/lp/soyuz/tests/test_archive_subscriptions.py	2018-02-02 10:33:11 +0000
@@ -1,8 +1,10 @@
-# Copyright 2009-2013 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test Archive features."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 from fixtures import FakeLogger
 from storm.store import Store
 from testtools.matchers import Equals

=== modified file 'lib/lp/soyuz/tests/test_archivejob.py'
--- lib/lp/soyuz/tests/test_archivejob.py	2017-01-14 00:17:26 +0000
+++ lib/lp/soyuz/tests/test_archivejob.py	2018-02-02 10:33:11 +0000
@@ -1,6 +1,8 @@
-# Copyright 2010-2017 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2018 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 debian.deb822 import Changes
 
 from lp.services.job.runner import JobRunner
@@ -43,7 +45,7 @@
         # deserialized from JSON, so the representation returned by
         # archive_job.metadata will be different from what we originally
         # passed in.
-        metadata_expected = (u'some', u'arbitrary', u'metadata')
+        metadata_expected = ('some', 'arbitrary', 'metadata')
         self.assertEqual(metadata_expected, archive_job.metadata)
 
 

=== modified file 'lib/lp/soyuz/tests/test_archivesubscriptionview.py'
--- lib/lp/soyuz/tests/test_archivesubscriptionview.py	2012-01-26 13:36:20 +0000
+++ lib/lp/soyuz/tests/test_archivesubscriptionview.py	2018-02-02 10:33:11 +0000
@@ -1,8 +1,10 @@
-# Copyright 2012 Canonical Ltd.  This software is licensed under the
+# Copyright 2012-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Unit tests for ArchiveSubscribersView."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from soupmatchers import (

=== modified file 'lib/lp/soyuz/tests/test_binaryandsourcepackagename.py'
--- lib/lp/soyuz/tests/test_binaryandsourcepackagename.py	2012-01-01 02:58:52 +0000
+++ lib/lp/soyuz/tests/test_binaryandsourcepackagename.py	2018-02-02 10:33:11 +0000
@@ -1,8 +1,10 @@
-# Copyright 2010 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test the binary and source package name vocabularies."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from storm.store import Store

=== modified file 'lib/lp/soyuz/tests/test_binarypackagebuild.py'
--- lib/lp/soyuz/tests/test_binarypackagebuild.py	2016-01-06 12:24:47 +0000
+++ lib/lp/soyuz/tests/test_binarypackagebuild.py	2018-02-02 10:33:11 +0000
@@ -1,8 +1,10 @@
-# Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test Build features."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 from datetime import (
     datetime,
     timedelta,
@@ -229,7 +231,7 @@
         [depwait_build] = depwait_source.createMissingBuilds()
         depwait_build.updateStatus(
             BuildStatus.MANUALDEPWAIT,
-            slave_status={'dependencies': u'dep-bin'})
+            slave_status={'dependencies': 'dep-bin'})
         return depwait_build
 
     def testUpdateDependenciesWorks(self):
@@ -257,13 +259,13 @@
         self.assertRaisesUnparsableDependencies(depwait_build, None)
 
         # Missing 'name'.
-        self.assertRaisesUnparsableDependencies(depwait_build, u'(>> version)')
+        self.assertRaisesUnparsableDependencies(depwait_build, '(>> version)')
 
         # Missing 'version'.
-        self.assertRaisesUnparsableDependencies(depwait_build, u'name (>>)')
+        self.assertRaisesUnparsableDependencies(depwait_build, 'name (>>)')
 
         # Missing comma between dependencies.
-        self.assertRaisesUnparsableDependencies(depwait_build, u'name1 name2')
+        self.assertRaisesUnparsableDependencies(depwait_build, 'name1 name2')
 
     def testBug378828(self):
         # `IBinaryPackageBuild.updateDependencies` copes with the
@@ -293,14 +295,14 @@
 
         depwait_build.updateStatus(
             BuildStatus.MANUALDEPWAIT,
-            slave_status={'dependencies': u'dep-bin (>> 666)'})
+            slave_status={'dependencies': 'dep-bin (>> 666)'})
         depwait_build.updateDependencies()
-        self.assertEqual(depwait_build.dependencies, u'dep-bin (>> 666)')
+        self.assertEqual(depwait_build.dependencies, 'dep-bin (>> 666)')
         depwait_build.updateStatus(
             BuildStatus.MANUALDEPWAIT,
-            slave_status={'dependencies': u'dep-bin (>= 666)'})
+            slave_status={'dependencies': 'dep-bin (>= 666)'})
         depwait_build.updateDependencies()
-        self.assertEqual(depwait_build.dependencies, u'')
+        self.assertEqual(depwait_build.dependencies, '')
 
     def testVersionedDependencyOnOldPublication(self):
         # `IBinaryPackageBuild.updateDependencies` doesn't just consider
@@ -316,24 +318,24 @@
 
         depwait_build.updateStatus(
             BuildStatus.MANUALDEPWAIT,
-            slave_status={'dependencies': u'dep-bin (= 666)'})
+            slave_status={'dependencies': 'dep-bin (= 666)'})
         depwait_build.updateDependencies()
-        self.assertEqual(depwait_build.dependencies, u'')
+        self.assertEqual(depwait_build.dependencies, '')
         depwait_build.updateStatus(
             BuildStatus.MANUALDEPWAIT,
-            slave_status={'dependencies': u'dep-bin (= 999)'})
+            slave_status={'dependencies': 'dep-bin (= 999)'})
         depwait_build.updateDependencies()
-        self.assertEqual(depwait_build.dependencies, u'')
+        self.assertEqual(depwait_build.dependencies, '')
 
     def testStrictInequalities(self):
         depwait_build = self._setupSimpleDepwaitContext()
         self.layer.txn.commit()
 
         for dep, expected in (
-                (u'dep-bin (<< 444)', u'dep-bin (<< 444)'),
-                (u'dep-bin (>> 444)', u''),
-                (u'dep-bin (<< 888)', u''),
-                (u'dep-bin (>> 888)', u'dep-bin (>> 888)'),
+                ('dep-bin (<< 444)', 'dep-bin (<< 444)'),
+                ('dep-bin (>> 444)', ''),
+                ('dep-bin (<< 888)', ''),
+                ('dep-bin (>> 888)', 'dep-bin (>> 888)'),
                 ):
             depwait_build.updateStatus(
                 BuildStatus.MANUALDEPWAIT, slave_status={'dependencies': dep})
@@ -349,10 +351,10 @@
         depwait_build.updateStatus(
             BuildStatus.MANUALDEPWAIT,
             slave_status={
-                'dependencies': u'dep-bin (>= 999) | alt-bin, dep-tools'})
+                'dependencies': 'dep-bin (>= 999) | alt-bin, dep-tools'})
         depwait_build.updateDependencies()
         self.assertEqual(
-            u'dep-bin (>= 999) | alt-bin, dep-tools',
+            'dep-bin (>= 999) | alt-bin, dep-tools',
             depwait_build.dependencies)
 
         self.publisher.getPubBinaries(
@@ -360,7 +362,7 @@
         self.layer.txn.commit()
 
         depwait_build.updateDependencies()
-        self.assertEqual(u'dep-tools', depwait_build.dependencies)
+        self.assertEqual('dep-tools', depwait_build.dependencies)
 
     def testAptVersionConstraints(self):
         # launchpad-buildd can return apt-style version constraints
@@ -370,14 +372,14 @@
 
         depwait_build.updateStatus(
             BuildStatus.MANUALDEPWAIT,
-            slave_status={'dependencies': u'dep-bin (> 666), dep-bin (< 777)'})
+            slave_status={'dependencies': 'dep-bin (> 666), dep-bin (< 777)'})
         depwait_build.updateDependencies()
-        self.assertEqual(depwait_build.dependencies, u'dep-bin (> 666)')
+        self.assertEqual(depwait_build.dependencies, 'dep-bin (> 666)')
         depwait_build.updateStatus(
             BuildStatus.MANUALDEPWAIT,
-            slave_status={'dependencies': u'dep-bin (> 665)'})
+            slave_status={'dependencies': 'dep-bin (> 665)'})
         depwait_build.updateDependencies()
-        self.assertEqual(depwait_build.dependencies, u'')
+        self.assertEqual(depwait_build.dependencies, '')
 
 
 class BaseTestCaseWithThreeBuilds(TestCaseWithFactory):

=== modified file 'lib/lp/soyuz/tests/test_binarypackagebuildbehaviour.py'
--- lib/lp/soyuz/tests/test_binarypackagebuildbehaviour.py	2017-07-26 13:21:25 +0000
+++ lib/lp/soyuz/tests/test_binarypackagebuildbehaviour.py	2018-02-02 10:33:11 +0000
@@ -1,8 +1,10 @@
-# Copyright 2010-2017 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for BinaryPackageBuildBehaviour."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 import gzip
@@ -258,7 +260,7 @@
             interactor.getBuildBehaviour(bq, builder, slave), BufferLogger())
         yield self.assertExpectedInteraction(
             slave.call_log, builder, build, lf, archive, ArchivePurpose.PPA,
-            extra_uploads=[(sprf_url, 'buildd', u'sekrit')],
+            extra_uploads=[(sprf_url, 'buildd', 'sekrit')],
             filemap_names=[sprf.libraryfile.filename])
 
     @defer.inlineCallbacks

=== modified file 'lib/lp/soyuz/tests/test_binarypackagename.py'
--- lib/lp/soyuz/tests/test_binarypackagename.py	2016-06-10 09:26:31 +0000
+++ lib/lp/soyuz/tests/test_binarypackagename.py	2018-02-02 10:33:11 +0000
@@ -1,8 +1,10 @@
-# Copyright 2010-2016 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test BinaryPackageName."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from zope.component import getUtility

=== modified file 'lib/lp/soyuz/tests/test_binarypackagerelease.py'
--- lib/lp/soyuz/tests/test_binarypackagerelease.py	2018-01-02 16:10:26 +0000
+++ lib/lp/soyuz/tests/test_binarypackagerelease.py	2018-02-02 10:33:11 +0000
@@ -1,8 +1,10 @@
-# Copyright 2010 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test BinaryPackageRelease."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from lp.soyuz.enums import BinaryPackageFormat

=== modified file 'lib/lp/soyuz/tests/test_build.py'
--- lib/lp/soyuz/tests/test_build.py	2018-01-02 16:10:26 +0000
+++ lib/lp/soyuz/tests/test_build.py	2018-02-02 10:33:11 +0000
@@ -1,6 +1,8 @@
-# Copyright 2011-2016 Canonical Ltd.  This software is licensed under the
+# Copyright 2011-2018 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 datetime import (

=== modified file 'lib/lp/soyuz/tests/test_build_depwait.py'
--- lib/lp/soyuz/tests/test_build_depwait.py	2018-01-02 16:10:26 +0000
+++ lib/lp/soyuz/tests/test_build_depwait.py	2018-02-02 10:33:11 +0000
@@ -1,6 +1,8 @@
-# Copyright 2011 Canonical Ltd.  This software is licensed under the
+# Copyright 2011-2018 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 transaction
@@ -67,7 +69,7 @@
             # Commit to make sure stuff hits the database.
             transaction.commit()
         build.updateDependencies()
-        self.assertEqual(u'', build.dependencies)
+        self.assertEqual('', build.dependencies)
 
     def test_update_dependancies_respects_component(self):
         # Since main can only utilise packages that are published in main,
@@ -98,4 +100,4 @@
             transaction.commit()
         # Now that we have moved it main, we can see it.
         build.updateDependencies()
-        self.assertEqual(u'', build.dependencies)
+        self.assertEqual('', build.dependencies)

=== modified file 'lib/lp/soyuz/tests/test_build_notify.py'
--- lib/lp/soyuz/tests/test_build_notify.py	2016-12-22 16:32:38 +0000
+++ lib/lp/soyuz/tests/test_build_notify.py	2018-02-02 10:33:11 +0000
@@ -1,6 +1,8 @@
-# Copyright 2011-2016 Canonical Ltd.  This software is licensed under the
+# Copyright 2011-2018 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 datetime import timedelta
@@ -127,7 +129,7 @@
             build.status.name, notification['X-Launchpad-Build-State'])
         self.assertEqual(
             build.archive.reference, notification['X-Launchpad-Archive'])
-        if ppa and build.archive.distribution.name == u'ubuntu':
+        if ppa and build.archive.distribution.name == 'ubuntu':
             self.assertEqual(
                 get_ppa_reference(self.ppa), notification['X-Launchpad-PPA'])
         body = notification.get_payload(decode=True)

=== modified file 'lib/lp/soyuz/tests/test_build_privacy.py'
--- lib/lp/soyuz/tests/test_build_privacy.py	2018-01-02 16:10:26 +0000
+++ lib/lp/soyuz/tests/test_build_privacy.py	2018-02-02 10:33:11 +0000
@@ -1,6 +1,8 @@
-# Copyright 2011 Canonical Ltd.  This software is licensed under the
+# Copyright 2011-2018 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/soyuz/tests/test_build_set.py'
--- lib/lp/soyuz/tests/test_build_set.py	2018-01-02 16:10:26 +0000
+++ lib/lp/soyuz/tests/test_build_set.py	2018-02-02 10:33:11 +0000
@@ -1,6 +1,8 @@
-# Copyright 2011 Canonical Ltd.  This software is licensed under the
+# Copyright 2011-2018 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/soyuz/tests/test_build_start_estimation.py'
--- lib/lp/soyuz/tests/test_build_start_estimation.py	2018-01-02 16:10:26 +0000
+++ lib/lp/soyuz/tests/test_build_start_estimation.py	2018-02-02 10:33:11 +0000
@@ -1,6 +1,8 @@
-# Copyright 2011 Canonical Ltd.  This software is licensed under the
+# Copyright 2011-2018 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 datetime import (

=== modified file 'lib/lp/soyuz/tests/test_distributionsourcepackagerelease.py'
--- lib/lp/soyuz/tests/test_distributionsourcepackagerelease.py	2016-06-17 15:46:57 +0000
+++ lib/lp/soyuz/tests/test_distributionsourcepackagerelease.py	2018-02-02 10:33:11 +0000
@@ -1,8 +1,10 @@
-# Copyright 2011-2014 Canonical Ltd.  This software is licensed under the
+# Copyright 2011-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests of DistributionSourcePackageRelease."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 from storm.store import Store
 from testtools.matchers import (
     Equals,

=== modified file 'lib/lp/soyuz/tests/test_distroseriesbinarypackage.py'
--- lib/lp/soyuz/tests/test_distroseriesbinarypackage.py	2018-01-02 10:54:31 +0000
+++ lib/lp/soyuz/tests/test_distroseriesbinarypackage.py	2018-02-02 10:33:11 +0000
@@ -1,8 +1,10 @@
-# Copyright 2010-2016 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for `DistroSeriesBinaryPackage`."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 __all__ = [
     'TestDistroSeriesBinaryPackage',

=== modified file 'lib/lp/soyuz/tests/test_distroseriesdifferencejob.py'
--- lib/lp/soyuz/tests/test_distroseriesdifferencejob.py	2018-01-02 16:10:26 +0000
+++ lib/lp/soyuz/tests/test_distroseriesdifferencejob.py	2018-02-02 10:33:11 +0000
@@ -1,8 +1,10 @@
-# Copyright 2011-2013 Canonical Ltd.  This software is licensed under the
+# Copyright 2011-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test `DistroSeriesDifferenceJob` and utility."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from psycopg2 import ProgrammingError
@@ -174,8 +176,8 @@
 
         sourcepackagenameid = spph.sourcepackagerelease.sourcepackagename.id
         expected_metadata = {
-            u'sourcepackagename': sourcepackagenameid,
-            u'parent_series': dsp.parent_series.id}
+            'sourcepackagename': sourcepackagenameid,
+            'parent_series': dsp.parent_series.id}
         self.assertThat(job, MatchesStructure.byEquality(
             distribution=dsp.derived_series.distribution,
             distroseries=dsp.derived_series,
@@ -202,7 +204,7 @@
         self.assertContentEqual(
             [spph.sourcepackagerelease.sourcepackagename.id
                 for spph in spphs],
-            [job.metadata[u'sourcepackagename'] for job in jobs])
+            [job.metadata['sourcepackagename'] for job in jobs])
 
     def test_create_multiple_jobs_creates_waiting_jobs(self):
         dsp = self.factory.makeDistroSeriesParent()

=== modified file 'lib/lp/soyuz/tests/test_distroseriesqueue_ddtp_tarball.py'
--- lib/lp/soyuz/tests/test_distroseriesqueue_ddtp_tarball.py	2016-02-05 16:51:12 +0000
+++ lib/lp/soyuz/tests/test_distroseriesqueue_ddtp_tarball.py	2018-02-02 10:33:11 +0000
@@ -1,4 +1,4 @@
-# Copyright 2012-2016 Canonical Ltd.  This software is licensed under the
+# Copyright 2012-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test upload and queue manipulation of DDTP tarballs.
@@ -14,6 +14,8 @@
 ddtp-tarball extraction.
 """
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 import os
 
 import transaction

=== modified file 'lib/lp/soyuz/tests/test_distroseriesqueue_debian_installer.py'
--- lib/lp/soyuz/tests/test_distroseriesqueue_debian_installer.py	2016-02-05 16:51:12 +0000
+++ lib/lp/soyuz/tests/test_distroseriesqueue_debian_installer.py	2018-02-02 10:33:11 +0000
@@ -1,4 +1,4 @@
-# Copyright 2012-2016 Canonical Ltd.  This software is licensed under the
+# Copyright 2012-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test upload and queue manipulation of debian-installer custom uploads.
@@ -7,6 +7,8 @@
 of debian-installer custom upload extraction.
 """
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 from itertools import chain
 import os
 

=== modified file 'lib/lp/soyuz/tests/test_distroseriesqueue_dist_upgrader.py'
--- lib/lp/soyuz/tests/test_distroseriesqueue_dist_upgrader.py	2016-02-05 16:51:12 +0000
+++ lib/lp/soyuz/tests/test_distroseriesqueue_dist_upgrader.py	2018-02-02 10:33:11 +0000
@@ -1,4 +1,4 @@
-# Copyright 2012-2016 Canonical Ltd.  This software is licensed under the
+# Copyright 2012-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test upload and queue manipulation of dist-upgrader tarballs.
@@ -7,6 +7,8 @@
 dist-upgrader tarball extraction.
 """
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 import os
 import shutil
 

=== modified file 'lib/lp/soyuz/tests/test_distroseriesqueue_rosetta_translations.py'
--- lib/lp/soyuz/tests/test_distroseriesqueue_rosetta_translations.py	2014-04-24 06:45:51 +0000
+++ lib/lp/soyuz/tests/test_distroseriesqueue_rosetta_translations.py	2018-02-02 10:33:11 +0000
@@ -1,4 +1,4 @@
-# Copyright 2013 Canonical Ltd.  This software is licensed under the
+# Copyright 2013-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test upload and queue manipulation of Rosetta Translations' tarballs.
@@ -7,10 +7,13 @@
 tests of rosetta-translations handling.
 """
 
-import transaction
+from __future__ import absolute_import, print_function, unicode_literals
+
 from os.path import relpath
+from tarfile import TarFile
+
 from storm.expr import Desc
-from tarfile import TarFile
+import transaction
 from zope.component import getUtility
 
 from lp.archiveuploader.nascentupload import NascentUpload
@@ -36,10 +39,10 @@
 from lp.testing.dbuser import dbuser
 from lp.testing.gpgkeys import import_public_test_keys
 from lp.testing.layers import LaunchpadZopelessLayer
+from lp.translations.enums import RosettaImportStatus
 from lp.translations.interfaces.translationimportqueue import (
     ITranslationImportQueue,
     )
-from lp.translations.enums import RosettaImportStatus
 from lp.translations.scripts.import_queue_gardener import ImportQueueGardener
 from lp.translations.scripts.po_import import TranslationsImport
 
@@ -172,7 +175,7 @@
         self.assertTrue(upload.do_accept())
 
         self.assertEqual(upload.queue_root.status, PackageUploadStatus.DONE)
-        spph = self.name16.archive.getPublishedSources(name=u"pmount").one()
+        spph = self.name16.archive.getPublishedSources(name="pmount").one()
         self.assertIsNotNone(spph)
         transaction.commit()
 
@@ -228,8 +231,7 @@
         with dbuser('copy_packages'):
             copy_job.run()
 
-        published_source = target_archive.getPublishedSources(
-            name=u'pmount')[0]
+        published_source = target_archive.getPublishedSources(name='pmount')[0]
         self.assertIsNotNone(published_source)
         self.assertEqual(
             published_source.sourcepackagerelease.upload_archive.displayname,

=== modified file 'lib/lp/soyuz/tests/test_doc.py'
--- lib/lp/soyuz/tests/test_doc.py	2015-09-04 12:19:07 +0000
+++ lib/lp/soyuz/tests/test_doc.py	2018-02-02 10:33:11 +0000
@@ -1,10 +1,12 @@
-# Copyright 2009-2012 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2018 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 logging
 import os
 import unittest

=== modified file 'lib/lp/soyuz/tests/test_hasbuildrecords.py'
--- lib/lp/soyuz/tests/test_hasbuildrecords.py	2018-01-02 16:10:26 +0000
+++ lib/lp/soyuz/tests/test_hasbuildrecords.py	2018-02-02 10:33:11 +0000
@@ -1,8 +1,10 @@
-# Copyright 2009-2017 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test implementations of the IHasBuildRecords interface."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 from zope.component import getUtility
 from zope.security.proxy import removeSecurityProxy
 

=== modified file 'lib/lp/soyuz/tests/test_initializedistroseriesjob.py'
--- lib/lp/soyuz/tests/test_initializedistroseriesjob.py	2015-04-20 15:59:52 +0000
+++ lib/lp/soyuz/tests/test_initializedistroseriesjob.py	2018-02-02 10:33:11 +0000
@@ -1,6 +1,8 @@
-# Copyright 2010 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2018 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 transaction
@@ -82,10 +84,10 @@
         packageset2 = self.factory.makePackageset()
 
         overlays = (True, False)
-        overlay_pockets = (u'Updates', u'Release')
-        overlay_components = (u"main", u"universe")
-        arches = (u'i386', u'amd64')
-        archindep_archtag = u'amd64'
+        overlay_pockets = ('Updates', 'Release')
+        overlay_components = ("main", "universe")
+        arches = ('i386', 'amd64')
+        archindep_archtag = 'amd64'
         packagesets = (packageset1.id, packageset2.id)
         rebuild = False
 
@@ -171,9 +173,9 @@
         be gotten out again."""
         parent = self.factory.makeDistroSeries()
         distroseries = self.factory.makeDistroSeries()
-        arches = (u'i386', u'amd64')
-        archindep_archtag = u'amd64'
-        packagesets = (u'1', u'2', u'3')
+        arches = ('i386', 'amd64')
+        archindep_archtag = 'amd64'
+        packagesets = ('1', '2', '3')
         overlays = (True, )
         overlay_pockets = ('Updates', )
         overlay_components = ('restricted', )
@@ -251,7 +253,7 @@
                 version=packages[package],
                 status=PackagePublishingStatus.PUBLISHED)
         test1 = getUtility(IPackagesetSet).new(
-            u'test1', u'test 1 packageset', parent.owner,
+            'test1', 'test 1 packageset', parent.owner,
             distroseries=parent)
         test1_packageset_id = str(test1.id)
         test1.addSources('udev')

=== modified file 'lib/lp/soyuz/tests/test_livefs.py'
--- lib/lp/soyuz/tests/test_livefs.py	2017-07-18 16:22:03 +0000
+++ lib/lp/soyuz/tests/test_livefs.py	2018-02-02 10:33:11 +0000
@@ -1,8 +1,10 @@
-# Copyright 2014-2017 Canonical Ltd.  This software is licensed under the
+# Copyright 2014-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test live filesystems."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from datetime import (
@@ -81,7 +83,7 @@
 
     def setUp(self):
         super(TestLiveFS, self).setUp()
-        self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: u"on"}))
+        self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: "on"}))
 
     def test_implements_interfaces(self):
         # LiveFS implements ILiveFS.
@@ -246,8 +248,8 @@
         build.updateStatus(BuildStatus.FULLYBUILT)
         build = livefs.requestBuild(
             livefs.owner, livefs.distro_series.main_archive, distroarchseries,
-            PackagePublishingPocket.RELEASE, version=u"20150101")
-        self.assertEqual(u"20150101", build.version)
+            PackagePublishingPocket.RELEASE, version="20150101")
+        self.assertEqual("20150101", build.version)
 
     def test_getBuilds(self):
         # Test the various getBuilds methods.
@@ -302,13 +304,13 @@
         distroseries = self.factory.makeDistroSeries()
         livefs = self.factory.makeLiveFS(
             registrant=owner, owner=owner, distroseries=distroseries,
-            name=u"condemned")
+            name="condemned")
         self.assertTrue(
-            getUtility(ILiveFSSet).exists(owner, distroseries, u"condemned"))
+            getUtility(ILiveFSSet).exists(owner, distroseries, "condemned"))
         with person_logged_in(livefs.owner):
             livefs.destroySelf()
         self.assertFalse(
-            getUtility(ILiveFSSet).exists(owner, distroseries, u"condemned"))
+            getUtility(ILiveFSSet).exists(owner, distroseries, "condemned"))
 
     def test_delete_with_builds(self):
         # A live filesystem with builds cannot be deleted.
@@ -316,14 +318,14 @@
         distroseries = self.factory.makeDistroSeries()
         livefs = self.factory.makeLiveFS(
             registrant=owner, owner=owner, distroseries=distroseries,
-            name=u"condemned")
+            name="condemned")
         self.factory.makeLiveFSBuild(livefs=livefs)
         self.assertTrue(
-            getUtility(ILiveFSSet).exists(owner, distroseries, u"condemned"))
+            getUtility(ILiveFSSet).exists(owner, distroseries, "condemned"))
         with person_logged_in(livefs.owner):
             self.assertRaises(CannotDeleteLiveFS, livefs.destroySelf)
         self.assertTrue(
-            getUtility(ILiveFSSet).exists(owner, distroseries, u"condemned"))
+            getUtility(ILiveFSSet).exists(owner, distroseries, "condemned"))
 
 
 class TestLiveFSSet(TestCaseWithFactory):
@@ -332,7 +334,7 @@
 
     def setUp(self):
         super(TestLiveFSSet, self).setUp()
-        self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: u"on"}))
+        self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: "on"}))
 
     def test_class_implements_interfaces(self):
         # The LiveFSSet class implements ILiveFSSet.
@@ -350,7 +352,7 @@
             registrant=registrant,
             owner=self.factory.makeTeam(owner=registrant),
             distro_series=self.factory.makeDistroSeries(),
-            name=self.factory.getUniqueString(u"livefs-name"),
+            name=self.factory.getUniqueString("livefs-name"),
             metadata=metadata)
 
     def test_creation(self):
@@ -380,7 +382,7 @@
                 livefs.owner, self.factory.makeDistroSeries(), livefs.name))
         self.assertFalse(
             getUtility(ILiveFSSet).exists(
-                livefs.owner, livefs.distro_series, u"different"))
+                livefs.owner, livefs.distro_series, "different"))
 
     def test_getByPerson(self):
         # ILiveFSSet.getByPerson returns all LiveFSes with the given owner.
@@ -427,7 +429,7 @@
 
     def setUp(self):
         super(TestLiveFSWebservice, self).setUp()
-        self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: u"on"}))
+        self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: "on"}))
         self.person = self.factory.makePerson(displayname="Test Person")
         self.webservice = webservice_for_person(
             self.person, permission=OAuthPermission.WRITE_PUBLIC)

=== modified file 'lib/lp/soyuz/tests/test_livefsbuild.py'
--- lib/lp/soyuz/tests/test_livefsbuild.py	2016-08-12 12:56:41 +0000
+++ lib/lp/soyuz/tests/test_livefsbuild.py	2018-02-02 10:33:11 +0000
@@ -1,8 +1,10 @@
-# Copyright 2014-2016 Canonical Ltd.  This software is licensed under the
+# Copyright 2014-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test live filesystem build features."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from datetime import (
@@ -90,7 +92,7 @@
 
     def setUp(self):
         super(TestLiveFSBuild, self).setUp()
-        self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: u"on"}))
+        self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: "on"}))
         self.build = self.factory.makeLiveFSBuild()
 
     def test_implements_interfaces(self):
@@ -238,7 +240,7 @@
             distroseries=distroseries, architecturetag="i386",
             processor=processor)
         build = self.factory.makeLiveFSBuild(
-            name=u"livefs-1", requester=person, owner=person,
+            name="livefs-1", requester=person, owner=person,
             distroarchseries=distroarchseries,
             date_created=datetime(2014, 4, 25, 10, 38, 0, tzinfo=pytz.UTC),
             status=BuildStatus.FAILEDTOBUILD,
@@ -291,7 +293,7 @@
 
     def setUp(self):
         super(TestLiveFSBuildSet, self).setUp()
-        self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: u"on"}))
+        self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: "on"}))
 
     def test_getByBuildFarmJob_works(self):
         build = self.factory.makeLiveFSBuild()
@@ -323,7 +325,7 @@
 
     def setUp(self):
         super(TestLiveFSBuildWebservice, self).setUp()
-        self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: u"on"}))
+        self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: "on"}))
         self.person = self.factory.makePerson()
         self.webservice = webservice_for_person(
             self.person, permission=OAuthPermission.WRITE_PRIVATE)
@@ -336,7 +338,7 @@
     def test_properties(self):
         # The basic properties of a LiveFSBuild are sensible.
         db_build = self.factory.makeLiveFSBuild(
-            requester=self.person, unique_key=u"foo",
+            requester=self.person, unique_key="foo",
             metadata_override={"image_format": "plain"},
             date_created=datetime(2014, 4, 25, 10, 38, 0, tzinfo=pytz.UTC))
         build_url = api_url(db_build)

=== modified file 'lib/lp/soyuz/tests/test_livefsbuildbehaviour.py'
--- lib/lp/soyuz/tests/test_livefsbuildbehaviour.py	2017-04-29 23:51:28 +0000
+++ lib/lp/soyuz/tests/test_livefsbuildbehaviour.py	2018-02-02 10:33:11 +0000
@@ -1,8 +1,10 @@
-# Copyright 2014-2017 Canonical Ltd.  This software is licensed under the
+# Copyright 2014-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test live filesystem build behaviour."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from datetime import datetime
@@ -63,7 +65,7 @@
 
     def setUp(self):
         super(TestLiveFSBuildBehaviourBase, self).setUp()
-        self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: u"on"}))
+        self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: "on"}))
 
     def makeJob(self, archive=None, pocket=PackagePublishingPocket.RELEASE,
                 **kwargs):
@@ -80,7 +82,7 @@
             processor=processor)
         build = self.factory.makeLiveFSBuild(
             archive=archive, distroarchseries=distroarchseries, pocket=pocket,
-            name=u"test-livefs", **kwargs)
+            name="test-livefs", **kwargs)
         return IBuildFarmJobBehaviour(build)
 
 
@@ -256,13 +258,13 @@
     """Provide the common makeBuild method returning a queued build."""
 
     def makeBuild(self):
-        self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: u"on"}))
+        self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: "on"}))
         build = self.factory.makeLiveFSBuild(status=BuildStatus.BUILDING)
         build.queueBuild()
         return build
 
     def makeUnmodifiableBuild(self):
-        self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: u"on"}))
+        self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: "on"}))
         build = self.factory.makeLiveFSBuild(status=BuildStatus.BUILDING)
         build.distro_series.status = SeriesStatus.OBSOLETE
         build.queueBuild()

=== modified file 'lib/lp/soyuz/tests/test_packagecloner.py'
--- lib/lp/soyuz/tests/test_packagecloner.py	2015-05-18 22:56:02 +0000
+++ lib/lp/soyuz/tests/test_packagecloner.py	2018-02-02 10:33:11 +0000
@@ -1,6 +1,8 @@
-# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2018 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/soyuz/tests/test_packagecopyjob.py'
--- lib/lp/soyuz/tests/test_packagecopyjob.py	2016-10-17 09:15:51 +0000
+++ lib/lp/soyuz/tests/test_packagecopyjob.py	2018-02-02 10:33:11 +0000
@@ -1,8 +1,10 @@
-# Copyright 2010-2016 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for sync package jobs."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 import operator
 from textwrap import dedent
 
@@ -507,7 +509,7 @@
         job.run()
 
         published_sources = job.target_archive.getPublishedSources(
-            name=u"libc", version="2.8-1")
+            name="libc", version="2.8-1")
         self.assertIsNot(None, published_sources.any())
 
         # The copy should have sent an email too. (see
@@ -606,7 +608,7 @@
 
         self.assertEqual(0, exit_code)
         copied_source_package = archive2.getPublishedSources(
-            name=u"libc", version="2.8-1", exact_match=True).first()
+            name="libc", version="2.8-1", exact_match=True).first()
         self.assertIsNot(copied_source_package, None)
 
     def test___repr__(self):
@@ -784,7 +786,7 @@
         self.runJob(job)
 
         new_spph = target_archive.getPublishedSources(
-            name=u'libc', version='2.8-1').one()
+            name='libc', version='2.8-1').one()
         self.assertEqual('restricted', new_spph.component.name)
         self.assertEqual('games', new_spph.section.name)
 
@@ -795,7 +797,7 @@
 
         # The binary has inherited its old primary component.
         new_bpph = target_archive.getAllPublishedBinaries(
-            name=u'copyme', version='2.8-1')[0]
+            name='copyme', version='2.8-1')[0]
         self.assertEqual('multiverse', new_bpph.component.name)
 
     def test_copying_to_ppa_archive(self):
@@ -828,7 +830,7 @@
         self.assertEqual(JobStatus.COMPLETED, job.status)
 
         new_publication = target_archive.getPublishedSources(
-            name=u'libc', version='2.8-1').one()
+            name='libc', version='2.8-1').one()
         self.assertEqual('main', new_publication.component.name)
         self.assertEqual('web', new_publication.section.name)
 
@@ -878,7 +880,7 @@
         # The copied source should have the manual overrides, not the
         # original values.
         new_publication = target_archive.getPublishedSources(
-            name=u'copyme', version='2.8-1').one()
+            name='copyme', version='2.8-1').one()
         self.assertEqual('restricted', new_publication.component.name)
         self.assertEqual('editors', new_publication.section.name)
 
@@ -899,7 +901,7 @@
 
         # There is no package of the same name already in the target
         # archive.
-        existing_sources = target_archive.getPublishedSources(name=u'copyme')
+        existing_sources = target_archive.getPublishedSources(name='copyme')
         self.assertEqual(None, existing_sources.any())
 
         # Now, run the copy job.
@@ -1020,7 +1022,7 @@
             spph, archive, archive, requester=archive.owner)
         self.runJob(job)
         self.assertEqual(JobStatus.COMPLETED, job.status)
-        published_sources = archive.getPublishedSources(name=u"copyme")
+        published_sources = archive.getPublishedSources(name="copyme")
         self.assertIsNotNone(published_sources.any())
 
     def test_copying_resurrects_deleted_package_primary_new(self):
@@ -1233,10 +1235,10 @@
         # Make sure packages were actually copied. The source has the
         # override that we gave to the PackageUpload, and its new
         # binaries inherit its component.
-        existing_sources = target_archive.getPublishedSources(name=u'copyme')
+        existing_sources = target_archive.getPublishedSources(name='copyme')
         self.assertEqual('restricted', existing_sources.one().component.name)
         existing_binaries = target_archive.getAllPublishedBinaries(
-            name=u'copyme')
+            name='copyme')
         self.assertEqual('restricted', existing_binaries[0].component.name)
 
         # It would be nice to test emails in a separate test but it would
@@ -1311,7 +1313,7 @@
               * closes: %s
 
              -- Foo Bar <f...@example.com>  Tue, 01 Jan 1970 01:50:41 +0000
-            """ % (bug282.id, bug281.id, bug280.id))
+            """ % (bug282.id, bug281.id, bug280.id)).encode("UTF-8")
         spr.changelog = self.factory.makeLibraryFileAlias(content=changelog)
         spr.changelog_entry = "dummy"
         self.layer.txn.commit()  # Librarian.
@@ -1406,10 +1408,10 @@
 
         # Make sure packages were actually copied.
         copied_sources = target_archive.getPublishedSources(
-            name=u"copyme", version="2.8-1")
+            name="copyme", version="2.8-1")
         self.assertNotEqual(0, copied_sources.count())
         copied_binaries = target_archive.getAllPublishedBinaries(
-            name=u"copyme")
+            name="copyme")
         self.assertNotEqual(0, copied_binaries.count())
 
         # Check that files were unembargoed.
@@ -1525,7 +1527,7 @@
         # Make sure packages were copied with the correct
         # phased_update_percentage.
         copied_binaries = archive.getAllPublishedBinaries(
-            name=u"copyme", pocket=PackagePublishingPocket.UPDATES)
+            name="copyme", pocket=PackagePublishingPocket.UPDATES)
         self.assertNotEqual(0, copied_binaries.count())
         for binary in copied_binaries:
             self.assertEqual(0, binary.phased_update_percentage)
@@ -1752,7 +1754,7 @@
             transaction.commit()
 
         published_sources = job.target_archive.getPublishedSources(
-            name=u"libc", version="2.8-1")
+            name="libc", version="2.8-1")
         self.assertIsNot(None, published_sources.any())
 
         # The copy should have sent an email too. (see
@@ -1765,13 +1767,13 @@
         # Accepting a suspended copy from the queue sends it back
         # through celery.
         source_pub = self.factory.makeSourcePackagePublishingHistory(
-            component=u"main", status=PackagePublishingStatus.PUBLISHED)
+            component="main", status=PackagePublishingStatus.PUBLISHED)
         target_series = self.factory.makeDistroSeries()
         getUtility(ISourcePackageFormatSelectionSet).add(
             target_series, SourcePackageFormat.FORMAT_1_0)
         requester = self.factory.makePerson()
         with person_logged_in(target_series.main_archive.owner):
-            target_series.main_archive.newComponentUploader(requester, u"main")
+            target_series.main_archive.newComponentUploader(requester, "main")
         job = getUtility(IPlainPackageCopyJobSource).create(
             package_name=source_pub.source_package_name,
             package_version=source_pub.source_package_version,

=== modified file 'lib/lp/soyuz/tests/test_packagediff.py'
--- lib/lp/soyuz/tests/test_packagediff.py	2015-12-02 10:57:23 +0000
+++ lib/lp/soyuz/tests/test_packagediff.py	2018-02-02 10:33:11 +0000
@@ -1,9 +1,9 @@
-# Copyright 2010-2015 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test source package diffs."""
 
-from __future__ import print_function
+from __future__ import absolute_import, print_function, unicode_literals
 
 __metaclass__ = type
 

=== modified file 'lib/lp/soyuz/tests/test_packagediffjob.py'
--- lib/lp/soyuz/tests/test_packagediffjob.py	2015-06-05 21:24:50 +0000
+++ lib/lp/soyuz/tests/test_packagediffjob.py	2018-02-02 10:33:11 +0000
@@ -1,6 +1,8 @@
-# Copyright 2013 Canonical Ltd.  This software is licensed under the
+# Copyright 2013-2018 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 testtools.content import text_content

=== modified file 'lib/lp/soyuz/tests/test_packageset.py'
--- lib/lp/soyuz/tests/test_packageset.py	2018-01-02 10:54:31 +0000
+++ lib/lp/soyuz/tests/test_packageset.py	2018-02-02 10:33:11 +0000
@@ -1,8 +1,10 @@
-# Copyright 2009-2014 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test Packageset features."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 from zope.component import getUtility
 from zope.security.interfaces import Unauthorized
 
@@ -268,7 +270,7 @@
             status=SeriesStatus.EXPERIMENTAL)
 
         self.person1 = self.factory.makePerson(
-            name='hacker', displayname=u'Happy Hacker')
+            name='hacker', displayname='Happy Hacker')
 
         self.packageset_set = getUtility(IPackagesetSet)
 
@@ -276,7 +278,7 @@
         # If the package set is the only one in the group the result set
         # returned by relatedSets() is empty.
         packageset = self.packageset_set.new(
-            u'kernel', u'Contains all OS kernel packages', self.person1,
+            'kernel', 'Contains all OS kernel packages', self.person1,
             self.distroseries_current)
 
         self.assertEqual(packageset.relatedSets().count(), 0)
@@ -288,18 +290,18 @@
 
         # The original package set.
         pset1 = self.packageset_set.new(
-            u'kernel', u'Contains all OS kernel packages', self.person1,
+            'kernel', 'Contains all OS kernel packages', self.person1,
             distroseries=self.distroseries_current)
 
         # A related package set.
         pset2 = self.packageset_set.new(
-            u'kernel', u'A related package set.', self.person1,
+            'kernel', 'A related package set.', self.person1,
             distroseries=self.distroseries_experimental, related_set=pset1)
         self.assertEqual(pset1.packagesetgroup, pset2.packagesetgroup)
 
         # An unrelated package set with the same name.
         pset3 = self.packageset_set.new(
-            u'kernel', u'Unrelated package set.', self.person1,
+            'kernel', 'Unrelated package set.', self.person1,
             distroseries=self.distroseries_experimental2)
         self.assertNotEqual(pset2.packagesetgroup, pset3.packagesetgroup)
 
@@ -320,12 +322,12 @@
     def test_destroy(self):
         series = self.factory.makeDistroSeries()
         pset = self.packageset_set.new(
-            u'kernel', u'Contains all OS kernel packages', self.person1,
+            'kernel', 'Contains all OS kernel packages', self.person1,
             series)
         pset.destroySelf()
         self.assertRaises(
             NoSuchPackageSet, self.packageset_set.getByName, series,
-            u'kernel')
+            'kernel')
 
         # Did we clean up the single packagesetgroup?
         store = IStore(PackagesetGroup)
@@ -334,20 +336,20 @@
 
     def test_destroy_with_ancestor(self):
         ancestor = self.packageset_set.new(
-            u'kernel', u'Contains all OS kernel packages', self.person1,
+            'kernel', 'Contains all OS kernel packages', self.person1,
             distroseries=self.distroseries_current)
         pset = self.packageset_set.new(
-            u'kernel', u'Contains all OS kernel packages', self.person1,
+            'kernel', 'Contains all OS kernel packages', self.person1,
             distroseries=self.distroseries_experimental, related_set=ancestor)
         pset.destroySelf()
         self.assertRaises(
             NoSuchPackageSet, self.packageset_set.getByName,
-            self.distroseries_experimental, u'kernel')
+            self.distroseries_experimental, 'kernel')
 
     def test_destroy_with_packages(self):
         series = self.factory.makeDistroSeries()
         pset = self.packageset_set.new(
-            u'kernel', u'Contains all OS kernel packages', self.person1,
+            'kernel', 'Contains all OS kernel packages', self.person1,
             series)
         package = self.factory.makeSourcePackageName()
         pset.addSources([package.name])
@@ -355,37 +357,37 @@
         pset.destroySelf()
         self.assertRaises(
             NoSuchPackageSet, self.packageset_set.getByName, series,
-            u'kernel')
+            'kernel')
 
     def test_destroy_child(self):
         series = self.factory.makeDistroSeries()
         parent = self.packageset_set.new(
-            u'core', u'Contains all the important packages', self.person1,
+            'core', 'Contains all the important packages', self.person1,
             series)
         child = self.packageset_set.new(
-            u'kernel', u'Contains all OS kernel packages', self.person1,
+            'kernel', 'Contains all OS kernel packages', self.person1,
             series)
         parent.add((child,))
 
         child.destroySelf()
         self.assertRaises(
             NoSuchPackageSet, self.packageset_set.getByName, series,
-            u'kernel')
+            'kernel')
         self.assertTrue(parent.setsIncluded(direct_inclusion=True).is_empty())
 
     def test_destroy_parent(self):
         series = self.factory.makeDistroSeries()
         parent = self.packageset_set.new(
-            u'core', u'Contains all the important packages', self.person1,
+            'core', 'Contains all the important packages', self.person1,
             series)
         child = self.packageset_set.new(
-            u'kernel', u'Contains all OS kernel packages', self.person1,
+            'kernel', 'Contains all OS kernel packages', self.person1,
             series)
         parent.add((child,))
 
         parent.destroySelf()
         self.assertRaises(
-            NoSuchPackageSet, self.packageset_set.getByName, series, u'core')
+            NoSuchPackageSet, self.packageset_set.getByName, series, 'core')
         self.assertTrue(child.setsIncludedBy(direct_inclusion=True).is_empty())
 
     def test_destroy_intermidate(self):
@@ -667,10 +669,10 @@
         # Normal users may not modify packagesets
         with person_logged_in(self.person2):
             self.assertRaises(
-                Unauthorized, setattr, self.packageset, 'name', u'renamed')
+                Unauthorized, setattr, self.packageset, 'name', 'renamed')
             self.assertRaises(
                 Unauthorized, setattr, self.packageset, 'description',
-                u'Re-described')
+                'Re-described')
             self.assertRaises(
                 Unauthorized, setattr, self.packageset, 'owner', self.person2)
             self.assertRaises(
@@ -687,8 +689,8 @@
                 Unauthorized, getattr, self.packageset, 'removeSubsets')
 
     def modifyPackageset(self):
-        self.packageset.name = u'renamed'
-        self.packageset.description = u'Re-described'
+        self.packageset.name = 'renamed'
+        self.packageset.description = 'Re-described'
         self.packageset.add((self.package,))
         self.packageset.remove((self.package,))
         self.packageset.addSources((self.package.name,))

=== modified file 'lib/lp/soyuz/tests/test_packagetranslationsuploadjob.py'
--- lib/lp/soyuz/tests/test_packagetranslationsuploadjob.py	2018-01-02 16:10:26 +0000
+++ lib/lp/soyuz/tests/test_packagetranslationsuploadjob.py	2018-02-02 10:33:11 +0000
@@ -1,10 +1,12 @@
-# Copyright 2013 Canonical Ltd.  This software is licensed under the
+# Copyright 2013-2018 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 testtools.content import text_content
 import transaction
-from testtools.content import text_content
 from zope.component import getUtility
 from zope.security.proxy import removeSecurityProxy
 

=== modified file 'lib/lp/soyuz/tests/test_packageupload.py'
--- lib/lp/soyuz/tests/test_packageupload.py	2017-06-13 12:19:20 +0000
+++ lib/lp/soyuz/tests/test_packageupload.py	2018-02-02 10:33:11 +0000
@@ -1,8 +1,10 @@
-# Copyright 2009-2017 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test Build features."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 from datetime import timedelta
 from urllib2 import (
     HTTPError,
@@ -316,7 +318,7 @@
 
         # There are now duplicate uploads in UNAPPROVED.
         unapproved = distroseries.getPackageUploads(
-            status=PackageUploadStatus.UNAPPROVED, name=u"cnews")
+            status=PackageUploadStatus.UNAPPROVED, name="cnews")
         self.assertEqual(2, unapproved.count())
 
         # Accepting one of them works.  (Since it's a single source upload,
@@ -806,13 +808,13 @@
     def test_getAll_without_exact_match_escapes_name(self):
         distroseries = self.factory.makeDistroSeries()
         self.assertContentEqual(
-            [], self.upload_set.getAll(distroseries, name=u"'"))
+            [], self.upload_set.getAll(distroseries, name="'"))
 
     def test_getAll_with_exact_match_escapes_name(self):
         distroseries = self.factory.makeDistroSeries()
         self.assertContentEqual(
             [], self.upload_set.getAll(
-                distroseries, name=u"'", exact_match=True))
+                distroseries, name="'", exact_match=True))
 
     def test_getAll_matches_source_upload_by_version(self):
         distroseries = self.factory.makeDistroSeries()

=== modified file 'lib/lp/soyuz/tests/test_person_createppa.py'
--- lib/lp/soyuz/tests/test_person_createppa.py	2015-05-12 05:45:08 +0000
+++ lib/lp/soyuz/tests/test_person_createppa.py	2018-02-02 10:33:11 +0000
@@ -1,8 +1,10 @@
-# Copyright 2010 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test the IPerson.createPPA() method."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from zope.security.interfaces import Unauthorized

=== modified file 'lib/lp/soyuz/tests/test_processacceptedbugsjob.py'
--- lib/lp/soyuz/tests/test_processacceptedbugsjob.py	2014-08-09 09:21:13 +0000
+++ lib/lp/soyuz/tests/test_processacceptedbugsjob.py	2018-02-02 10:33:11 +0000
@@ -1,8 +1,10 @@
-# Copyright 2012-2014 Canonical Ltd.  This software is licensed under the
+# Copyright 2012-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for jobs to close bugs for accepted package uploads."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 from cStringIO import StringIO
 from itertools import product
 from textwrap import dedent
@@ -169,7 +171,7 @@
             bugs[3][0].id,
             bugs[4][0].id,
             bugs[5][0].id,
-            ))
+            )).encode("UTF-8")
         lfa = self.factory.makeLibraryFileAlias(content=changelog)
         removeSecurityProxy(spr).changelog = lfa
         self.layer.txn.commit()

=== modified file 'lib/lp/soyuz/tests/test_publishing.py'
--- lib/lp/soyuz/tests/test_publishing.py	2016-09-24 06:21:55 +0000
+++ lib/lp/soyuz/tests/test_publishing.py	2018-02-02 10:33:11 +0000
@@ -1,8 +1,10 @@
-# Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test native publication workflow for Soyuz. """
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 import datetime
 import operator
 import os
@@ -154,7 +156,7 @@
         self.breezy_autotest_i386 = self.breezy_autotest['i386']
         self.breezy_autotest_hppa = self.breezy_autotest['hppa']
 
-    def addMockFile(self, filename, filecontent='nothing', restricted=False):
+    def addMockFile(self, filename, filecontent=b'nothing', restricted=False):
         """Add a mock file in Librarian.
 
         Returns a ILibraryFileAlias corresponding to the file uploaded.
@@ -167,7 +169,7 @@
     def addPackageUpload(self, archive, distroseries,
                          pocket=PackagePublishingPocket.RELEASE,
                          changes_file_name="foo_666_source.changes",
-                         changes_file_content="fake changes file content",
+                         changes_file_content=b"fake changes file content",
                          upload_status=PackageUploadStatus.DONE):
         signing_key = self.person.gpg_keys[0]
         package_upload = distroseries.createQueueEntry(
@@ -187,8 +189,8 @@
 
     def getPubSource(self, sourcename=None, version=None, component='main',
                      filename=None, section='base',
-                     filecontent='I do not care about sources.',
-                     changes_file_content="Fake: fake changes file content",
+                     filecontent=b'I do not care about sources.',
+                     changes_file_content=b"Fake: fake changes file content",
                      status=PackagePublishingStatus.PENDING,
                      pocket=PackagePublishingPocket.RELEASE,
                      urgency=SourcePackageUrgency.LOW,
@@ -299,8 +301,8 @@
                        shlibdep=None, depends=None, recommends=None,
                        suggests=None, conflicts=None, replaces=None,
                        provides=None, pre_depends=None, enhances=None,
-                       breaks=None, filecontent='bbbiiinnnaaarrryyy',
-                       changes_file_content="Fake: fake changes file",
+                       breaks=None, filecontent=b'bbbiiinnnaaarrryyy',
+                       changes_file_content=b"Fake: fake changes file",
                        status=PackagePublishingStatus.PENDING,
                        pocket=PackagePublishingPocket.RELEASE,
                        format=BinaryPackageFormat.DEB,
@@ -376,7 +378,7 @@
             published_binaries, key=operator.attrgetter('id'), reverse=True)
 
     def uploadBinaryForBuild(
-        self, build, binaryname, filecontent="anything",
+        self, build, binaryname, filecontent=b"anything",
         summary="summary", description="description", shlibdep=None,
         depends=None, recommends=None, suggests=None, conflicts=None,
         replaces=None, provides=None, pre_depends=None, enhances=None,
@@ -448,7 +450,7 @@
         if not build.log:
             build.setLog(
                 self.addMockFile(
-                    buildlog_filename, filecontent='Built!',
+                    buildlog_filename, filecontent=b'Built!',
                     restricted=build.archive.private))
 
         return binarypackagerelease
@@ -674,7 +676,7 @@
     def test_publish_source(self):
         # Source publications result in a PUBLISHED publishing record and
         # the corresponding files are dumped in the disk pool/.
-        pub_source = self.getPubSource(filecontent='Hello world')
+        pub_source = self.getPubSource(filecontent=b'Hello world')
         pub_source.publish(self.disk_pool, self.logger)
         self.assertEqual(PackagePublishingStatus.PUBLISHED, pub_source.status)
         pool_path = "%s/main/f/foo/foo_666.dsc" % self.pool_dir
@@ -683,7 +685,7 @@
     def test_publish_binaries(self):
         # Binary publications result in a PUBLISHED publishing record and
         # the corresponding files are dumped in the disk pool/.
-        pub_binary = self.getPubBinaries(filecontent='Hello world')[0]
+        pub_binary = self.getPubBinaries(filecontent=b'Hello world')[0]
         pub_binary.publish(self.disk_pool, self.logger)
         self.assertEqual(PackagePublishingStatus.PUBLISHED, pub_binary.status)
         pool_path = "%s/main/f/foo/foo-bin_666_all.deb" % self.pool_dir
@@ -694,7 +696,7 @@
         # Archive.publish_debug_symbols is false just sets PUBLISHED,
         # without a file in the pool.
         pubs = self.getPubBinaries(
-            binaryname='dbg', filecontent='Hello world', with_debug=True)
+            binaryname='dbg', filecontent=b'Hello world', with_debug=True)
 
         def publish_everything():
             existence_map = {}
@@ -707,13 +709,13 @@
             return existence_map
 
         self.assertEqual(
-            {u'dbg_666_all.deb': True, u'dbg-dbgsym_666_all.ddeb': False},
+            {'dbg_666_all.deb': True, 'dbg-dbgsym_666_all.ddeb': False},
             publish_everything())
 
         pubs[0].archive.publish_debug_symbols = True
 
         self.assertEqual(
-            {u'dbg_666_all.deb': True, u'dbg-dbgsym_666_all.ddeb': True},
+            {'dbg_666_all.deb': True, 'dbg-dbgsym_666_all.ddeb': True},
             publish_everything())
 
     def testPublishingOverwriteFileInPool(self):
@@ -730,7 +732,7 @@
         with open(foo_dsc_path, 'w') as foo_dsc:
             foo_dsc.write('Hello world')
 
-        pub_source = self.getPubSource(filecontent="Something")
+        pub_source = self.getPubSource(filecontent=b"Something")
         pub_source.publish(self.disk_pool, self.logger)
 
         # And an oops should be filed for the error.
@@ -742,7 +744,7 @@
 
     def testPublishingDifferentContents(self):
         """Test if publishOne refuses to overwrite its own publication."""
-        pub_source = self.getPubSource(filecontent='foo is happy')
+        pub_source = self.getPubSource(filecontent=b'foo is happy')
         pub_source.publish(self.disk_pool, self.logger)
         self.layer.commit()
 
@@ -754,7 +756,7 @@
         # try to publish 'foo' again with a different content, it
         # raises internally and keeps the files with the original
         # content.
-        pub_source2 = self.getPubSource(filecontent='foo is depressing')
+        pub_source2 = self.getPubSource(filecontent=b'foo is depressing')
         pub_source2.publish(self.disk_pool, self.logger)
         self.layer.commit()
 
@@ -769,7 +771,7 @@
         mark it as PUBLISHED.
         """
         pub_source = self.getPubSource(
-            sourcename='bar', filecontent='bar is good')
+            sourcename='bar', filecontent=b'bar is good')
         pub_source.publish(self.disk_pool, self.logger)
         self.layer.commit()
         bar_name = "%s/main/b/bar/bar_666.dsc" % self.pool_dir
@@ -778,7 +780,7 @@
         self.assertEqual(pub_source.status, PackagePublishingStatus.PUBLISHED)
 
         pub_source2 = self.getPubSource(
-            sourcename='bar', filecontent='bar is good')
+            sourcename='bar', filecontent=b'bar is good')
         pub_source2.publish(self.disk_pool, self.logger)
         self.layer.commit()
         pub_source2.sync()
@@ -790,7 +792,7 @@
         After check if the pool file contents as the same, it should
         create a symlink in the new pointing to the original file.
         """
-        content = 'am I a file or a symbolic link ?'
+        content = b'am I a file or a symbolic link ?'
         # publish sim.dsc in main and re-publish in universe
         pub_source = self.getPubSource(sourcename='sim', filecontent=content)
         pub_source2 = self.getPubSource(
@@ -813,7 +815,7 @@
         # remains pending.
         pub_source3 = self.getPubSource(
             sourcename='sim', component='restricted',
-            filecontent='It is all my fault')
+            filecontent=b'It is all my fault')
         pub_source3.publish(self.disk_pool, self.logger)
         self.layer.commit()
 
@@ -832,7 +834,7 @@
         test_disk_pool = DiskPool(test_pool_dir, test_temp_dir, self.logger)
 
         pub_source = self.getPubSource(
-            sourcename="foo", filecontent='Am I a PPA Record ?',
+            sourcename="foo", filecontent=b'Am I a PPA Record ?',
             archive=cprov.archive)
         pub_source.publish(test_disk_pool, self.logger)
         self.layer.commit()

=== modified file 'lib/lp/soyuz/tests/test_publishing_models.py'
--- lib/lp/soyuz/tests/test_publishing_models.py	2018-01-02 16:10:26 +0000
+++ lib/lp/soyuz/tests/test_publishing_models.py	2018-02-02 10:33:11 +0000
@@ -1,8 +1,10 @@
-# Copyright 2009-2015 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test model and set utilities used for publishing."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 from zope.component import getUtility
 from zope.security.proxy import removeSecurityProxy
 

=== modified file 'lib/lp/soyuz/tests/test_sourcepackagerelease.py'
--- lib/lp/soyuz/tests/test_sourcepackagerelease.py	2018-01-02 16:10:26 +0000
+++ lib/lp/soyuz/tests/test_sourcepackagerelease.py	2018-02-02 10:33:11 +0000
@@ -2,11 +2,13 @@
 # NOTE: The first line above must stay first; do not move the copyright
 # notice to the top.  See http://www.python.org/dev/peps/pep-0263/.
 #
-# Copyright 2010-2011 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test SourcePackageRelease."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from textwrap import dedent
@@ -76,7 +78,7 @@
         # that version and up to and including the context SPR.
         changelog = self.factory.makeChangelog(
             spn="foo", versions=["1.3",  "1.2",  "1.1",  "1.0"])
-        expected_changelog = dedent(u"""\
+        expected_changelog = dedent("""\
             foo (1.3) unstable; urgency=low
 
               * 1.3.
@@ -98,13 +100,13 @@
 
     def test_aggregate_changelog_invalid_utf8(self):
         # aggregate_changelog copes with invalid UTF-8.
-        changelog_main = dedent(u"""\
+        changelog_main = dedent("""\
             foo (1.0) unstable; urgency=low
 
               * 1.0 (héllo).""").encode("ISO-8859-1")
         changelog_trailer = (
-            u" -- Føo Bær <f...@example.com>  "
-            u"Tue, 01 Jan 1970 01:50:41 +0000").encode("ISO-8859-1")
+            " -- Føo Bær <f...@example.com>  "
+            "Tue, 01 Jan 1970 01:50:41 +0000").encode("ISO-8859-1")
         changelog_text = changelog_main + b"\n\n" + changelog_trailer
         changelog = self.factory.makeLibraryFileAlias(content=changelog_text)
         spph = self.factory.makeSourcePackagePublishingHistory(

=== modified file 'lib/lp/soyuz/tests/test_vocabularies.py'
--- lib/lp/soyuz/tests/test_vocabularies.py	2014-08-08 17:27:07 +0000
+++ lib/lp/soyuz/tests/test_vocabularies.py	2018-02-02 10:33:11 +0000
@@ -1,8 +1,10 @@
-# Copyright 2012-2014 Canonical Ltd.  This software is licensed under the
+# Copyright 2012-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test Soyuz vocabularies."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from testtools.matchers import MatchesStructure

=== modified file 'lib/lp/soyuz/tests/test_yuitests.py'
--- lib/lp/soyuz/tests/test_yuitests.py	2012-01-01 02:58:52 +0000
+++ lib/lp/soyuz/tests/test_yuitests.py	2018-02-02 10:33:11 +0000
@@ -1,8 +1,10 @@
-# Copyright 2010 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2018 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__ = []
 

_______________________________________________
Mailing list: https://launchpad.net/~launchpad-reviewers
Post to     : launchpad-reviewers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~launchpad-reviewers
More help   : https://help.launchpad.net/ListHelp

Reply via email to