← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:py3-processacceptedbugsjob-bytesio into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:py3-processacceptedbugsjob-bytesio into launchpad:master.

Commit message:
Port lp.soyuz.tests.test_processacceptedbugsjob to io.BytesIO

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/394724
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-processacceptedbugsjob-bytesio into launchpad:master.
diff --git a/lib/lp/soyuz/tests/test_processacceptedbugsjob.py b/lib/lp/soyuz/tests/test_processacceptedbugsjob.py
index 38ec2ba..1a7beb3 100644
--- a/lib/lp/soyuz/tests/test_processacceptedbugsjob.py
+++ b/lib/lp/soyuz/tests/test_processacceptedbugsjob.py
@@ -5,7 +5,7 @@
 
 from __future__ import absolute_import, print_function, unicode_literals
 
-from cStringIO import StringIO
+import io
 from itertools import product
 from textwrap import dedent
 
@@ -68,7 +68,7 @@ class TestBugIDsFromChangesFile(TestCaseWithFactory):
         """Serialize self.changes and use get_bug_ids_from_changes_file to
         extract bug IDs from it.
         """
-        stream = StringIO()
+        stream = io.BytesIO()
         self.changes.dump(stream)
         stream.seek(0)
         return get_bug_ids_from_changes_file(stream)
@@ -237,7 +237,7 @@ class TestClosingPrivateBugs(TestCaseWithFactory):
         dsp = series.distribution.getSourcePackage(spr.sourcepackagename)
         bug = self.factory.makeBug(
             target=dsp, information_type=InformationType.USERDATA)
-        changes = StringIO(changes_file_template % bug.id)
+        changes = io.BytesIO((changes_file_template % bug.id).encode("UTF-8"))
 
         with person_logged_in(archive_admin):
             # The archive admin user can't normally see this bug.
@@ -410,7 +410,8 @@ class TestProcessAcceptedBugsJob(TestCaseWithFactory):
 
         out, err, exit_code = run_script(
             "LP_DEBUG_SQL=1 cronscripts/process-job-source.py -vv %s" % (
-                IProcessAcceptedBugsJobSource.getName()))
+                IProcessAcceptedBugsJobSource.getName()),
+            universal_newlines=True)
 
         self.addDetail("stdout", text_content(out))
         self.addDetail("stderr", text_content(err))