launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #25365
[Merge] ~cjwatson/launchpad:py3-archivepublisher-unicode into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-archivepublisher-unicode into launchpad:master.
Commit message:
Port unicode() calls in lp.archivepublisher to Python 3
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/391266
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-archivepublisher-unicode into launchpad:master.
diff --git a/lib/lp/archivepublisher/tests/test_archivegpgsigningkey.py b/lib/lp/archivepublisher/tests/test_archivegpgsigningkey.py
index 67366bd..8b35b74 100644
--- a/lib/lp/archivepublisher/tests/test_archivegpgsigningkey.py
+++ b/lib/lp/archivepublisher/tests/test_archivegpgsigningkey.py
@@ -10,6 +10,7 @@ __metaclass__ = type
import os
from textwrap import dedent
+import six
from testtools.matchers import (
FileContains,
StartsWith,
@@ -70,7 +71,7 @@ class TestSignableArchiveWithSigningKey(TestCaseWithFactory):
self.distro = self.factory.makeDistribution()
db_pubconf = getUtility(IPublisherConfigSet).getByDistribution(
self.distro)
- db_pubconf.root_dir = unicode(self.temp_dir)
+ db_pubconf.root_dir = six.ensure_text(self.temp_dir)
self.archive = self.factory.makeArchive(
distribution=self.distro, purpose=ArchivePurpose.PRIMARY)
self.archive_root = getPubConfig(self.archive).archiveroot
@@ -207,7 +208,7 @@ class TestSignableArchiveWithRunParts(RunPartsMixin, TestCaseWithFactory):
self.distro = self.factory.makeDistribution()
db_pubconf = getUtility(IPublisherConfigSet).getByDistribution(
self.distro)
- db_pubconf.root_dir = unicode(self.temp_dir)
+ db_pubconf.root_dir = six.ensure_text(self.temp_dir)
self.archive = self.factory.makeArchive(
distribution=self.distro, purpose=ArchivePurpose.PRIMARY)
self.archive_root = getPubConfig(self.archive).archiveroot
diff --git a/lib/lp/archivepublisher/tests/test_customupload.py b/lib/lp/archivepublisher/tests/test_customupload.py
index 43a88db..a1d1f45 100644
--- a/lib/lp/archivepublisher/tests/test_customupload.py
+++ b/lib/lp/archivepublisher/tests/test_customupload.py
@@ -16,6 +16,7 @@ import tempfile
import unittest
from fixtures import MonkeyPatch
+import six
from testtools.deferredruntest import AsynchronousDeferredRunTest
from testtools.matchers import (
Equals,
@@ -240,7 +241,7 @@ class TestSigning(TestCaseWithFactory, RunPartsMixin):
self.distro = self.factory.makeDistribution()
db_pubconf = getUtility(IPublisherConfigSet).getByDistribution(
self.distro)
- db_pubconf.root_dir = unicode(self.temp_dir)
+ db_pubconf.root_dir = six.ensure_text(self.temp_dir)
self.archive = self.factory.makeArchive(
distribution=self.distro, purpose=ArchivePurpose.PRIMARY)
diff --git a/lib/lp/archivepublisher/tests/test_ddtp_tarball.py b/lib/lp/archivepublisher/tests/test_ddtp_tarball.py
index 568c699..9c210b2 100644
--- a/lib/lp/archivepublisher/tests/test_ddtp_tarball.py
+++ b/lib/lp/archivepublisher/tests/test_ddtp_tarball.py
@@ -11,6 +11,7 @@ from __future__ import absolute_import, print_function, unicode_literals
import os
+import six
from zope.component import getUtility
from lp.archivepublisher.config import getPubConfig
@@ -32,7 +33,7 @@ class TestDdtpTarball(TestCaseWithFactory):
self.distro = self.factory.makeDistribution()
db_pubconf = getUtility(IPublisherConfigSet).getByDistribution(
self.distro)
- db_pubconf.root_dir = unicode(self.temp_dir)
+ db_pubconf.root_dir = six.ensure_text(self.temp_dir)
self.archive = self.factory.makeArchive(
distribution=self.distro, purpose=ArchivePurpose.PRIMARY)
self.suite = "distroseries"
diff --git a/lib/lp/archivepublisher/tests/test_debian_installer.py b/lib/lp/archivepublisher/tests/test_debian_installer.py
index 0b106e1..3eecee3 100644
--- a/lib/lp/archivepublisher/tests/test_debian_installer.py
+++ b/lib/lp/archivepublisher/tests/test_debian_installer.py
@@ -12,6 +12,7 @@ from __future__ import absolute_import, print_function, unicode_literals
import os
from textwrap import dedent
+import six
from testtools.matchers import DirContains
from zope.component import getUtility
@@ -39,7 +40,7 @@ class TestDebianInstaller(RunPartsMixin, TestCaseWithFactory):
self.distro = self.factory.makeDistribution()
db_pubconf = getUtility(IPublisherConfigSet).getByDistribution(
self.distro)
- db_pubconf.root_dir = unicode(self.temp_dir)
+ db_pubconf.root_dir = six.ensure_text(self.temp_dir)
self.archive = self.factory.makeArchive(
distribution=self.distro, purpose=ArchivePurpose.PRIMARY)
self.suite = "distroseries"
diff --git a/lib/lp/archivepublisher/tests/test_dist_upgrader.py b/lib/lp/archivepublisher/tests/test_dist_upgrader.py
index 1da88f9..2c5c13b 100644
--- a/lib/lp/archivepublisher/tests/test_dist_upgrader.py
+++ b/lib/lp/archivepublisher/tests/test_dist_upgrader.py
@@ -12,6 +12,7 @@ from __future__ import absolute_import, print_function, unicode_literals
import os
from textwrap import dedent
+import six
from testtools.matchers import DirContains
from zope.component import getUtility
@@ -48,7 +49,7 @@ class TestDistUpgrader(RunPartsMixin, TestCaseWithFactory):
self.distro = self.factory.makeDistribution()
db_pubconf = getUtility(IPublisherConfigSet).getByDistribution(
self.distro)
- db_pubconf.root_dir = unicode(self.temp_dir)
+ db_pubconf.root_dir = six.ensure_text(self.temp_dir)
self.archive = self.factory.makeArchive(
distribution=self.distro, purpose=ArchivePurpose.PRIMARY)
self.suite = "distroseries"
diff --git a/lib/lp/archivepublisher/tests/test_generate_contents_files.py b/lib/lp/archivepublisher/tests/test_generate_contents_files.py
index 4534570..b0238e2 100644
--- a/lib/lp/archivepublisher/tests/test_generate_contents_files.py
+++ b/lib/lp/archivepublisher/tests/test_generate_contents_files.py
@@ -11,6 +11,7 @@ import hashlib
from optparse import OptionValueError
import os
+import six
from testtools.matchers import StartsWith
from lp.archivepublisher.scripts.generate_contents_files import (
@@ -114,7 +115,7 @@ class TestGenerateContentsFiles(TestCaseWithFactory):
be cleaned up after the test.
"""
return self.factory.makeDistribution(
- publish_root_dir=unicode(self.makeTemporaryDirectory()))
+ publish_root_dir=six.ensure_text(self.makeTemporaryDirectory()))
def makeScript(self, distribution=None, run_setup=True):
"""Create a script for testing."""
diff --git a/lib/lp/archivepublisher/tests/test_publish_ftpmaster.py b/lib/lp/archivepublisher/tests/test_publish_ftpmaster.py
index 450da11..9339459 100644
--- a/lib/lp/archivepublisher/tests/test_publish_ftpmaster.py
+++ b/lib/lp/archivepublisher/tests/test_publish_ftpmaster.py
@@ -14,6 +14,7 @@ import time
from apt_pkg import TagFile
from fixtures import MonkeyPatch
+import six
from testtools.matchers import (
ContainsDict,
Equals,
@@ -136,7 +137,7 @@ class HelpersMixin:
will be cleaned up after the test.
"""
return self.factory.makeDistribution(
- publish_root_dir=unicode(self.makeTemporaryDirectory()))
+ publish_root_dir=six.ensure_text(self.makeTemporaryDirectory()))
def makeScript(self, distro=None, extra_args=[]):
"""Produce instance of the `PublishFTPMaster` script."""
@@ -150,8 +151,7 @@ class HelpersMixin:
def setUpForScriptRun(self, distro):
"""Mock up config to run the script on `distro`."""
pub_config = getUtility(IPublisherConfigSet).getByDistribution(distro)
- pub_config.root_dir = unicode(
- self.makeTemporaryDirectory())
+ pub_config.root_dir = six.ensure_text(self.makeTemporaryDirectory())
class TestNewerMtime(TestCase):
diff --git a/lib/lp/archivepublisher/tests/test_publishdistro.py b/lib/lp/archivepublisher/tests/test_publishdistro.py
index 6507fa6..ae9a1b3 100644
--- a/lib/lp/archivepublisher/tests/test_publishdistro.py
+++ b/lib/lp/archivepublisher/tests/test_publishdistro.py
@@ -13,6 +13,7 @@ import shutil
import subprocess
import sys
+import six
from testtools.matchers import (
Not,
PathExists,
@@ -497,7 +498,7 @@ class TestPublishDistroMethods(TestCaseWithFactory):
# this, getPublisher will create archives in the current
# directory.
return self.factory.makeDistribution(
- publish_root_dir=unicode(self.makeTemporaryDirectory()))
+ publish_root_dir=six.ensure_text(self.makeTemporaryDirectory()))
def makeScript(self, distribution=None, args=[], all_derived=False):
"""Create a `PublishDistro` for `distribution`."""
diff --git a/lib/lp/archivepublisher/tests/test_publisher.py b/lib/lp/archivepublisher/tests/test_publisher.py
index 3d0d89d..76553b3 100644
--- a/lib/lp/archivepublisher/tests/test_publisher.py
+++ b/lib/lp/archivepublisher/tests/test_publisher.py
@@ -3406,7 +3406,7 @@ class TestPublisherLite(TestCaseWithFactory):
def test_writeReleaseFile_dumps_release_file(self):
# _writeReleaseFile writes a Release file for a suite.
- root = unicode(self.makeTemporaryDirectory())
+ root = six.ensure_text(self.makeTemporaryDirectory())
series = self.makePublishableSeries(root)
spph = self.makePublishablePackage(series)
suite = series.name + pocketsuffix[spph.pocket]
@@ -3424,7 +3424,7 @@ class TestPublisherLite(TestCaseWithFactory):
def test_writeReleaseFile_creates_directory_if_necessary(self):
# If the suite is new and its release directory does not exist
# yet, _writeReleaseFile will create it.
- root = unicode(self.makeTemporaryDirectory())
+ root = six.ensure_text(self.makeTemporaryDirectory())
series = self.makePublishableSeries(root)
spph = self.makePublishablePackage(series)
suite = series.name + pocketsuffix[spph.pocket]
@@ -3437,7 +3437,7 @@ class TestPublisherLite(TestCaseWithFactory):
self.assertTrue(file_exists(release_path))
def test_syncTimestamps_makes_timestamps_match_latest(self):
- root = unicode(self.makeTemporaryDirectory())
+ root = six.ensure_text(self.makeTemporaryDirectory())
series = self.makePublishableSeries(root)
location = self.getReleaseFileDir(root, series, series.name)
os.makedirs(location)
@@ -3504,8 +3504,8 @@ class TestDirectoryHash(TestDirectoryHashHelpers):
layer = ZopelessDatabaseLayer
def test_checksum_files_created(self):
- tmpdir = unicode(self.makeTemporaryDirectory())
- rootdir = unicode(self.makeTemporaryDirectory())
+ tmpdir = six.ensure_text(self.makeTemporaryDirectory())
+ rootdir = six.ensure_text(self.makeTemporaryDirectory())
for dh_file in self.all_hash_files:
checksum_file = os.path.join(rootdir, dh_file)
@@ -3522,8 +3522,8 @@ class TestDirectoryHash(TestDirectoryHashHelpers):
self.assertFalse(os.path.exists(checksum_file))
def test_basic_file_add(self):
- tmpdir = unicode(self.makeTemporaryDirectory())
- rootdir = unicode(self.makeTemporaryDirectory())
+ tmpdir = six.ensure_text(self.makeTemporaryDirectory())
+ rootdir = six.ensure_text(self.makeTemporaryDirectory())
test1_file = os.path.join(rootdir, "test1")
test1_hash = self.createTestFile(test1_file, "test1")
@@ -3550,8 +3550,8 @@ class TestDirectoryHash(TestDirectoryHashHelpers):
self.assertThat(self.fetchSums(rootdir), MatchesDict(expected))
def test_basic_directory_add(self):
- tmpdir = unicode(self.makeTemporaryDirectory())
- rootdir = unicode(self.makeTemporaryDirectory())
+ tmpdir = six.ensure_text(self.makeTemporaryDirectory())
+ rootdir = six.ensure_text(self.makeTemporaryDirectory())
test1_file = os.path.join(rootdir, "test1")
test1_hash = self.createTestFile(test1_file, "test1 dir")
diff --git a/lib/lp/archivepublisher/tests/test_signing.py b/lib/lp/archivepublisher/tests/test_signing.py
index 32f1df8..b4abc0e 100644
--- a/lib/lp/archivepublisher/tests/test_signing.py
+++ b/lib/lp/archivepublisher/tests/test_signing.py
@@ -21,6 +21,7 @@ from fixtures import (
from mock import call
from pytz import utc
import scandir
+import six
from testtools.matchers import (
Contains,
Equals,
@@ -198,7 +199,7 @@ class TestSigningHelpers(TestCaseWithFactory):
self.distro = self.factory.makeDistribution()
db_pubconf = getUtility(IPublisherConfigSet).getByDistribution(
self.distro)
- db_pubconf.root_dir = unicode(self.temp_dir)
+ db_pubconf.root_dir = six.ensure_text(self.temp_dir)
self.archive = self.factory.makeArchive(
distribution=self.distro, purpose=ArchivePurpose.PRIMARY)
self.signing_dir = os.path.join(