Skip to content

Commit 26619b2

Browse files
committed
Use raw_download option when downloading code coverage artifacts as bytes from GCP
Exactly the same as d348115, when downloading as bytes. Work around googleapis/google-resumable-media-python#204
1 parent d9026a8 commit 26619b2

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

bot/code_coverage_bot/commit_coverage.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ def generate(server_address: str, repo_dir: str, out_dir: str = ".") -> None:
5252
blob = bucket.blob("commit_coverage.json.zst")
5353
if blob.exists():
5454
dctx = zstandard.ZstdDecompressor()
55-
commit_coverage = json.loads(dctx.decompress(blob.download_as_bytes()))
55+
commit_coverage = json.loads(
56+
dctx.decompress(blob.download_as_bytes(raw_download=True))
57+
)
5658
else:
5759
commit_coverage = {}
5860

bot/tests/test_commit_coverage.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def upload_from_string(self, val):
5050
nonlocal uploaded_data
5151
uploaded_data = val
5252

53-
def download_as_bytes(self):
53+
def download_as_bytes(self, raw_download=False):
5454
assert False
5555

5656
def patch(self):
@@ -175,7 +175,7 @@ def upload_from_string(self, val):
175175
nonlocal uploaded_data
176176
uploaded_data = val
177177

178-
def download_as_bytes(self):
178+
def download_as_bytes(self, raw_download=False):
179179
assert False
180180

181181
def patch(self):
@@ -322,7 +322,7 @@ def upload_from_string(self, val):
322322
nonlocal uploaded_data
323323
uploaded_data = val
324324

325-
def download_as_bytes(self):
325+
def download_as_bytes(self, raw_download=False):
326326
return zstandard.ZstdCompressor().compress(
327327
json.dumps(
328328
{

0 commit comments

Comments
 (0)