← Back to team overview

launchpad-reviewers team mailing list archive

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

 

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

Commit message:
Port TestUploadProcessorBase.addMockFile to io.BytesIO

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/394476
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-uploadprocessor-addmockfile-bytesio into launchpad:master.
diff --git a/lib/lp/archiveuploader/tests/test_uploadprocessor.py b/lib/lp/archiveuploader/tests/test_uploadprocessor.py
index b469bd4..6fb09fb 100644
--- a/lib/lp/archiveuploader/tests/test_uploadprocessor.py
+++ b/lib/lp/archiveuploader/tests/test_uploadprocessor.py
@@ -11,9 +11,9 @@ __all__ = [
     "TestUploadProcessorBase",
     ]
 
+import io
 import os
 import shutil
-from StringIO import StringIO
 import tempfile
 
 from fixtures import MonkeyPatch
@@ -290,10 +290,10 @@ class TestUploadProcessorBase(TestCaseWithFactory):
 
         self.switchToUploader()
 
-    def addMockFile(self, filename, content="anything"):
+    def addMockFile(self, filename, content=b"anything"):
         """Return a librarian file."""
         return getUtility(ILibraryFileAliasSet).create(
-            filename, len(content), StringIO(content),
+            filename, len(content), io.BytesIO(content),
             'application/x-gtar')
 
     def queueUpload(self, upload_name, relative_path="", test_files_dir=None,