launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #29115
[Merge] ~cjwatson/launchpad:githostingclient-blob-encoding-tests-py38 into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:githostingclient-blob-encoding-tests-py38 into launchpad:master.
Commit message:
Adjust GitHostingClient blob encoding tests for Python >= 3.8
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/429253
https://github.com/python/cpython/pull/7416 changed the exception message raised for base64 inputs whose length has a remainder of 1 when divided by 4. In these tests, we want to make sure that the underlying exception message is passed through to allow debugging, but we don't much care about the exact details, so change the input data to something that raises an "Incorrect padding" exception on Python 3.8 as well as on earlier versions.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:githostingclient-blob-encoding-tests-py38 into launchpad:master.
diff --git a/lib/lp/code/model/tests/test_githosting.py b/lib/lp/code/model/tests/test_githosting.py
index bb321b9..c93b311 100644
--- a/lib/lp/code/model/tests/test_githosting.py
+++ b/lib/lp/code/model/tests/test_githosting.py
@@ -292,7 +292,7 @@ class TestGitHostingClient(TestCase):
def test_getCommits_filter_paths_bad_encoding(self):
commit_json = {
"sha1": "0",
- "blobs": {".launchpad.yaml": {"data": "x", "size": 1}},
+ "blobs": {".launchpad.yaml": {"data": "xy", "size": 2}},
}
with self.mockRequests("POST", json=[commit_json]):
self.assertRaisesWithContent(
@@ -565,7 +565,7 @@ class TestGitHostingClient(TestCase):
)
def test_getBlob_bad_encoding(self):
- with self.mockRequests("GET", json={"data": "x", "size": 1}):
+ with self.mockRequests("GET", json={"data": "xy", "size": 2}):
self.assertRaisesWithContent(
GitRepositoryScanFault,
"Failed to get file from Git repository: Incorrect padding",