← Back to team overview

launchpad-reviewers team mailing list archive

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

 

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

Commit message:
Fix TestDistroSeriesQueueRosettaTranslationsTarball for Python 3

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

The fileobj passed to TarFile.open must be opened in binary mode; but we might as well just pass in a path instead, since that's simpler.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-TestDistroSeriesQueueRosettaTranslationsTarball into launchpad:master.
diff --git a/lib/lp/soyuz/tests/test_distroseriesqueue_rosetta_translations.py b/lib/lp/soyuz/tests/test_distroseriesqueue_rosetta_translations.py
index 75559c0..0f05f58 100644
--- a/lib/lp/soyuz/tests/test_distroseriesqueue_rosetta_translations.py
+++ b/lib/lp/soyuz/tests/test_distroseriesqueue_rosetta_translations.py
@@ -98,8 +98,9 @@ class TestDistroSeriesQueueRosettaTranslationsTarball(
         self.assertEqual(1, len(upload.queue_root.customfiles))
 
     def _getImportableFilesFromTarball(self):
-        tarball = TarFile.open(mode="r:gz", fileobj=open(datadir(
-            "rosetta-translations/%s" % self.translations_file)))
+        tarball_path = datadir(
+            "rosetta-translations/%s" % self.translations_file)
+        tarball = TarFile.open(name=tarball_path, mode="r:gz")
         return [relpath(file_, "./source/") for file_ in tarball.getnames() if
                 ".po" in file_]