← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:py3-remaining-breezy into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:py3-remaining-breezy into launchpad:master.

Commit message:
Fix various small remaining bytes/text issues related to Breezy

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/398706
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-remaining-breezy into launchpad:master.
diff --git a/lib/lp/code/interfaces/tests/test_branch.py b/lib/lp/code/interfaces/tests/test_branch.py
index 2eaab2f..ed75d2f 100644
--- a/lib/lp/code/interfaces/tests/test_branch.py
+++ b/lib/lp/code/interfaces/tests/test_branch.py
@@ -8,6 +8,7 @@ __metaclass__ = type
 from breezy.branch import format_registry as branch_format_registry
 from breezy.bzr import BzrProber
 from breezy.repository import format_registry as repo_format_registry
+import six
 
 from lp.code.bzr import (
     BranchFormat,
@@ -38,8 +39,8 @@ class TestFormatSupport(TestCase):
     def breezy_is_subset(self, breezy_formats, launchpad_enum):
         """Ensure the Breezy format marker list is a subset of Launchpad."""
         breezy_format_strings = set(breezy_formats)
-        launchpad_format_strings = set(format.title for format
-                                       in launchpad_enum.items)
+        launchpad_format_strings = set(
+            six.ensure_binary(format.title) for format in launchpad_enum.items)
         self.assertEqual(
             set(), breezy_format_strings.difference(launchpad_format_strings))
 
diff --git a/lib/lp/code/model/tests/test_branchjob.py b/lib/lp/code/model/tests/test_branchjob.py
index 02c0fa1..d731310 100644
--- a/lib/lp/code/model/tests/test_branchjob.py
+++ b/lib/lp/code/model/tests/test_branchjob.py
@@ -202,10 +202,10 @@ class TestBranchScanJob(TestCaseWithFactory):
         product = self.factory.makeProduct()
         private_bug = self.factory.makeBug(
             target=product, information_type=InformationType.USERDATA)
-        bug_line = b'https://launchpad.net/bugs/%s fixed' % private_bug.id
+        bug_line = 'https://launchpad.net/bugs/%s fixed' % private_bug.id
         with override_environ(BRZ_EMAIL='me@xxxxxxxxxxx'):
             bzr_tree.commit(
-                'First commit', rev_id=b'rev1', revprops={b'bugs': bug_line})
+                'First commit', rev_id=b'rev1', revprops={'bugs': bug_line})
         job = BranchScanJob.create(db_branch)
         with dbuser("branchscanner"):
             job.run()
@@ -970,7 +970,7 @@ class TestRosettaUploadJob(TestCaseWithFactory):
                 if file_content is None:
                     raise IndexError  # Same as if missing.
             except IndexError:
-                file_content = self.factory.getUniqueString()
+                file_content = self.factory.getUniqueBytes()
             dname = os.path.dirname(file_name)
             self.tree.controldir.root_transport.clone(dname).create_prefix()
             self.tree.controldir.root_transport.put_bytes(
@@ -1049,9 +1049,9 @@ class TestRosettaUploadJob(TestCaseWithFactory):
         # files from the branch but does not add changed directories to the
         # template_files_changed and translation_files_changed lists .
         pot_path = "subdir/foo.pot"
-        pot_content = self.factory.getUniqueString()
+        pot_content = self.factory.getUniqueBytes()
         po_path = "subdir/foo.po"
-        po_content = self.factory.getUniqueString()
+        po_content = self.factory.getUniqueBytes()
         self._makeBranchWithTreeAndFiles(((pot_path, pot_content),
                                           (po_path, po_content)))
         self._makeProductSeries(TranslationsBranchImportMode.NO_IMPORT)
diff --git a/lib/lp/codehosting/bzrutils.py b/lib/lp/codehosting/bzrutils.py
index 308bbe0..3793be7 100644
--- a/lib/lp/codehosting/bzrutils.py
+++ b/lib/lp/codehosting/bzrutils.py
@@ -324,7 +324,7 @@ def get_branch_info(branch):
     """
     info = {}
     info['stacked_on_url'] = get_stacked_on_url(branch)
-    info['last_revision_id'] = branch.last_revision()
+    info['last_revision_id'] = six.ensure_str(branch.last_revision())
     # XXX: Aaron Bentley 2008-06-13
     # Bazaar does not provide a public API for learning about
     # format markers.  Fix this in Bazaar, then here.
diff --git a/lib/lp/translations/tests/test_rosetta_branches_script.py b/lib/lp/translations/tests/test_rosetta_branches_script.py
index 947d231..b225817 100644
--- a/lib/lp/translations/tests/test_rosetta_branches_script.py
+++ b/lib/lp/translations/tests/test_rosetta_branches_script.py
@@ -42,7 +42,7 @@ class TestRosettaBranchesScript(TestCaseWithFactory):
 
     def _setup_series_branch(self, pot_path):
         self.useBzrBranches()
-        pot_content = self.factory.getUniqueString()
+        pot_content = self.factory.getUniqueBytes()
         branch, tree = self.create_branch_and_tree()
         tree.controldir.root_transport.put_bytes(pot_path, pot_content)
         tree.add(pot_path)