← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:unsixify-tempdir into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:unsixify-tempdir into launchpad:master.

Commit message:
Remove unnecessary ensure_text of temporary directory paths

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/420849

On Python 2 we needed to convert temporary directory paths to Unicode in some publisher tests, since some parts of the Python 2 standard library had slightly different behaviour with `str` vs. `unicode` paths.  None of this is necessary on Python 3.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:unsixify-tempdir into launchpad:master.
diff --git a/lib/lp/archivepublisher/tests/test_archivegpgsigningkey.py b/lib/lp/archivepublisher/tests/test_archivegpgsigningkey.py
index 15ac59c..4c8463e 100644
--- a/lib/lp/archivepublisher/tests/test_archivegpgsigningkey.py
+++ b/lib/lp/archivepublisher/tests/test_archivegpgsigningkey.py
@@ -7,7 +7,6 @@ import os
 from textwrap import dedent
 from unittest import mock
 
-import six
 from testtools.matchers import (
     Equals,
     FileContains,
@@ -71,7 +70,7 @@ class TestSignableArchiveWithSigningKey(TestCaseWithFactory):
         self.distro = self.factory.makeDistribution()
         db_pubconf = getUtility(IPublisherConfigSet).getByDistribution(
             self.distro)
-        db_pubconf.root_dir = six.ensure_text(self.temp_dir)
+        db_pubconf.root_dir = self.temp_dir
         self.archive = self.factory.makeArchive(
             distribution=self.distro, purpose=ArchivePurpose.PRIMARY)
         self.archive_root = getPubConfig(self.archive).archiveroot
@@ -207,7 +206,7 @@ class TestSignableArchiveWithRunParts(RunPartsMixin, TestCaseWithFactory):
         self.distro = self.factory.makeDistribution()
         db_pubconf = getUtility(IPublisherConfigSet).getByDistribution(
             self.distro)
-        db_pubconf.root_dir = six.ensure_text(self.temp_dir)
+        db_pubconf.root_dir = 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 adae66c..f62feaa 100644
--- a/lib/lp/archivepublisher/tests/test_customupload.py
+++ b/lib/lp/archivepublisher/tests/test_customupload.py
@@ -11,7 +11,6 @@ import tempfile
 import unittest
 
 from fixtures import MonkeyPatch
-import six
 from testtools.deferredruntest import AsynchronousDeferredRunTest
 from testtools.matchers import (
     Equals,
@@ -236,7 +235,7 @@ class TestSigning(TestCaseWithFactory, RunPartsMixin):
         self.distro = self.factory.makeDistribution()
         db_pubconf = getUtility(IPublisherConfigSet).getByDistribution(
             self.distro)
-        db_pubconf.root_dir = six.ensure_text(self.temp_dir)
+        db_pubconf.root_dir = 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 5e196b8..88e2d4f 100644
--- a/lib/lp/archivepublisher/tests/test_ddtp_tarball.py
+++ b/lib/lp/archivepublisher/tests/test_ddtp_tarball.py
@@ -9,7 +9,6 @@ tests of ddtp-tarball upload and queue manipulation.
 
 import os
 
-import six
 from zope.component import getUtility
 
 from lp.archivepublisher.config import getPubConfig
@@ -32,7 +31,7 @@ class TestDdtpTarball(TestCaseWithFactory):
         self.distro = self.factory.makeDistribution()
         db_pubconf = getUtility(IPublisherConfigSet).getByDistribution(
             self.distro)
-        db_pubconf.root_dir = six.ensure_text(self.temp_dir)
+        db_pubconf.root_dir = self.temp_dir
         self.archive = self.factory.makeArchive(
             distribution=self.distro, purpose=ArchivePurpose.PRIMARY)
         self.distroseries = self.factory.makeDistroSeries(
diff --git a/lib/lp/archivepublisher/tests/test_debian_installer.py b/lib/lp/archivepublisher/tests/test_debian_installer.py
index d885337..3bc26a5 100644
--- a/lib/lp/archivepublisher/tests/test_debian_installer.py
+++ b/lib/lp/archivepublisher/tests/test_debian_installer.py
@@ -10,7 +10,6 @@ high-level tests of debian-installer upload and queue manipulation.
 import os
 from textwrap import dedent
 
-import six
 from testtools.matchers import DirContains
 from zope.component import getUtility
 
@@ -38,7 +37,7 @@ class TestDebianInstaller(RunPartsMixin, TestCaseWithFactory):
         self.distro = self.factory.makeDistribution()
         db_pubconf = getUtility(IPublisherConfigSet).getByDistribution(
             self.distro)
-        db_pubconf.root_dir = six.ensure_text(self.temp_dir)
+        db_pubconf.root_dir = 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 66a7021..69092c8 100644
--- a/lib/lp/archivepublisher/tests/test_dist_upgrader.py
+++ b/lib/lp/archivepublisher/tests/test_dist_upgrader.py
@@ -10,7 +10,6 @@ tests of dist-upgrader upload and queue manipulation.
 import os
 from textwrap import dedent
 
-import six
 from testtools.matchers import DirContains
 from zope.component import getUtility
 
@@ -41,7 +40,7 @@ class TestDistUpgrader(RunPartsMixin, TestCaseWithFactory):
         self.distro = self.factory.makeDistribution()
         db_pubconf = getUtility(IPublisherConfigSet).getByDistribution(
             self.distro)
-        db_pubconf.root_dir = six.ensure_text(self.temp_dir)
+        db_pubconf.root_dir = 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 6116eb8..bf3fc9c 100644
--- a/lib/lp/archivepublisher/tests/test_generate_contents_files.py
+++ b/lib/lp/archivepublisher/tests/test_generate_contents_files.py
@@ -7,7 +7,6 @@ import hashlib
 from optparse import OptionValueError
 import os
 
-import six
 from testtools.matchers import StartsWith
 
 from lp.archivepublisher.scripts.generate_contents_files import (
@@ -111,7 +110,7 @@ class TestGenerateContentsFiles(TestCaseWithFactory):
         be cleaned up after the test.
         """
         return self.factory.makeDistribution(
-            publish_root_dir=six.ensure_text(self.makeTemporaryDirectory()))
+            publish_root_dir=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 1847248..b4015d5 100644
--- a/lib/lp/archivepublisher/tests/test_publish_ftpmaster.py
+++ b/lib/lp/archivepublisher/tests/test_publish_ftpmaster.py
@@ -11,7 +11,6 @@ import time
 
 from apt_pkg import TagFile
 from fixtures import MonkeyPatch
-import six
 from testtools.matchers import (
     ContainsDict,
     Equals,
@@ -137,7 +136,7 @@ class HelpersMixin:
         will be cleaned up after the test.
         """
         return self.factory.makeDistribution(
-            publish_root_dir=six.ensure_text(self.makeTemporaryDirectory()))
+            publish_root_dir=self.makeTemporaryDirectory())
 
     def makeScript(self, distro=None, extra_args=[]):
         """Produce instance of the `PublishFTPMaster` script."""
@@ -151,7 +150,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 = six.ensure_text(self.makeTemporaryDirectory())
+        pub_config.root_dir = self.makeTemporaryDirectory()
 
 
 class TestNewerMtime(TestCase):
diff --git a/lib/lp/archivepublisher/tests/test_publishdistro.py b/lib/lp/archivepublisher/tests/test_publishdistro.py
index fa137f4..5d833ed 100644
--- a/lib/lp/archivepublisher/tests/test_publishdistro.py
+++ b/lib/lp/archivepublisher/tests/test_publishdistro.py
@@ -8,7 +8,6 @@ import os
 import shutil
 import subprocess
 
-import six
 from storm.store import Store
 from testtools.matchers import (
     Not,
@@ -540,7 +539,7 @@ class TestPublishDistroMethods(TestCaseWithFactory):
         # this, getPublisher will create archives in the current
         # directory.
         return self.factory.makeDistribution(
-            publish_root_dir=six.ensure_text(self.makeTemporaryDirectory()))
+            publish_root_dir=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 cfb48d5..af62d58 100644
--- a/lib/lp/archivepublisher/tests/test_publisher.py
+++ b/lib/lp/archivepublisher/tests/test_publisher.py
@@ -3380,7 +3380,7 @@ class TestPublisherLite(TestCaseWithFactory):
 
     def test_writeReleaseFile_dumps_release_file(self):
         # _writeReleaseFile writes a Release file for a suite.
-        root = six.ensure_text(self.makeTemporaryDirectory())
+        root = self.makeTemporaryDirectory()
         series = self.makePublishableSeries(root)
         spph = self.makePublishablePackage(series)
         suite = series.name + pocketsuffix[spph.pocket]
@@ -3398,7 +3398,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 = six.ensure_text(self.makeTemporaryDirectory())
+        root = self.makeTemporaryDirectory()
         series = self.makePublishableSeries(root)
         spph = self.makePublishablePackage(series)
         suite = series.name + pocketsuffix[spph.pocket]
@@ -3411,7 +3411,7 @@ class TestPublisherLite(TestCaseWithFactory):
         self.assertTrue(file_exists(release_path))
 
     def test_syncTimestamps_makes_timestamps_match_latest(self):
-        root = six.ensure_text(self.makeTemporaryDirectory())
+        root = self.makeTemporaryDirectory()
         series = self.makePublishableSeries(root)
         location = self.getReleaseFileDir(root, series, series.name)
         os.makedirs(location)
@@ -3478,8 +3478,8 @@ class TestDirectoryHash(TestDirectoryHashHelpers):
     layer = ZopelessDatabaseLayer
 
     def test_checksum_files_created(self):
-        tmpdir = six.ensure_text(self.makeTemporaryDirectory())
-        rootdir = six.ensure_text(self.makeTemporaryDirectory())
+        tmpdir = self.makeTemporaryDirectory()
+        rootdir = self.makeTemporaryDirectory()
 
         for dh_file in self.all_hash_files:
             checksum_file = os.path.join(rootdir, dh_file)
@@ -3496,8 +3496,8 @@ class TestDirectoryHash(TestDirectoryHashHelpers):
                 self.assertFalse(os.path.exists(checksum_file))
 
     def test_basic_file_add(self):
-        tmpdir = six.ensure_text(self.makeTemporaryDirectory())
-        rootdir = six.ensure_text(self.makeTemporaryDirectory())
+        tmpdir = self.makeTemporaryDirectory()
+        rootdir = self.makeTemporaryDirectory()
         test1_file = os.path.join(rootdir, "test1")
         test1_hash = self.createTestFile(test1_file, b"test1")
 
@@ -3524,8 +3524,8 @@ class TestDirectoryHash(TestDirectoryHashHelpers):
         self.assertThat(self.fetchSums(rootdir), MatchesDict(expected))
 
     def test_basic_directory_add(self):
-        tmpdir = six.ensure_text(self.makeTemporaryDirectory())
-        rootdir = six.ensure_text(self.makeTemporaryDirectory())
+        tmpdir = self.makeTemporaryDirectory()
+        rootdir = self.makeTemporaryDirectory()
         test1_file = os.path.join(rootdir, "test1")
         test1_hash = self.createTestFile(test1_file, b"test1 dir")
 
diff --git a/lib/lp/archivepublisher/tests/test_signing.py b/lib/lp/archivepublisher/tests/test_signing.py
index 6746037..e330354 100644
--- a/lib/lp/archivepublisher/tests/test_signing.py
+++ b/lib/lp/archivepublisher/tests/test_signing.py
@@ -16,7 +16,6 @@ from fixtures import (
     MonkeyPatch,
     )
 from pytz import utc
-import six
 from testtools.matchers import (
     Contains,
     Equals,
@@ -194,7 +193,7 @@ class TestSigningHelpers(TestCaseWithFactory):
         self.distro = self.factory.makeDistribution()
         db_pubconf = getUtility(IPublisherConfigSet).getByDistribution(
             self.distro)
-        db_pubconf.root_dir = six.ensure_text(self.temp_dir)
+        db_pubconf.root_dir = self.temp_dir
         self.archive = self.factory.makeArchive(
             distribution=self.distro, purpose=ArchivePurpose.PRIMARY)
         self.signing_dir = os.path.join(