launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #25065
[Merge] ~cjwatson/launchpad:py3-oci-tests-bytes into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-oci-tests-bytes into launchpad:master.
Commit message:
Fix some bytes handling errors in lp.oci tests
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/387774
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-oci-tests-bytes into launchpad:master.
diff --git a/lib/lp/oci/tests/test_ocirecipebuildbehaviour.py b/lib/lp/oci/tests/test_ocirecipebuildbehaviour.py
index f621037..d30254e 100644
--- a/lib/lp/oci/tests/test_ocirecipebuildbehaviour.py
+++ b/lib/lp/oci/tests/test_ocirecipebuildbehaviour.py
@@ -501,7 +501,7 @@ class TestHandleStatusForOCIRecipeBuild(WithScenarios,
}
self.factory.makeOCIFile(
build=self.build, layer_file_digest=u'digest_1',
- content="retrieved from librarian")
+ content=b"retrieved from librarian")
def assertResultCount(self, count, result):
self.assertEqual(
@@ -544,7 +544,7 @@ class TestHandleStatusForOCIRecipeBuild(WithScenarios,
"""We should be able to reuse a layer file from a separate build."""
oci_file = self.factory.makeOCIFile(
layer_file_digest=u'digest_2',
- content="layer 2 retrieved from librarian")
+ content=b"layer 2 retrieved from librarian")
now = datetime.now(pytz.UTC)
mock_datetime = self.useFixture(MockPatch(
diff --git a/lib/lp/oci/tests/test_ociregistryclient.py b/lib/lp/oci/tests/test_ociregistryclient.py
index 433d7d3..2edec41 100644
--- a/lib/lp/oci/tests/test_ociregistryclient.py
+++ b/lib/lp/oci/tests/test_ociregistryclient.py
@@ -8,6 +8,7 @@ from __future__ import absolute_import, print_function, unicode_literals
__metaclass__ = type
from functools import partial
+import io
import json
import os
import tarfile
@@ -19,7 +20,6 @@ from requests.exceptions import (
HTTPError,
)
import responses
-from six import StringIO
from tenacity import RetryError
from testtools.matchers import (
AfterPreprocessing,
@@ -101,17 +101,17 @@ class TestOCIRegistryClient(OCIConfigHelperMixin, SpyProxyCallsMixin,
def _makeFiles(self):
self.factory.makeOCIFile(
build=self.build,
- content=json.dumps(self.manifest),
+ content=json.dumps(self.manifest).encode('UTF-8'),
filename='manifest.json',
)
self.factory.makeOCIFile(
build=self.build,
- content=json.dumps(self.digests),
+ content=json.dumps(self.digests).encode('UTF-8'),
filename='digests.json',
)
self.factory.makeOCIFile(
build=self.build,
- content=json.dumps(self.config),
+ content=json.dumps(self.config).encode('UTF-8'),
filename='config_file_1.json'
)
@@ -125,7 +125,7 @@ class TestOCIRegistryClient(OCIConfigHelperMixin, SpyProxyCallsMixin,
with open(file_path, 'w') as fd:
fd.write(digest)
- fileout = StringIO()
+ fileout = io.BytesIO()
tar = tarfile.open(mode="w:gz", fileobj=fileout)
tar.add(file_path, 'layer.tar')
tar.close()