Skip to content

Commit

Permalink
Use raw_download option when downloading code coverage artifacts as b…
Browse files Browse the repository at this point in the history
…ytes from GCP

Exactly the same as d348115, when downloading as bytes.
Work around googleapis/google-resumable-media-python#204
  • Loading branch information
marco-c committed Oct 23, 2023
1 parent d9026a8 commit 26619b2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion bot/code_coverage_bot/commit_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ def generate(server_address: str, repo_dir: str, out_dir: str = ".") -> None:
blob = bucket.blob("commit_coverage.json.zst")
if blob.exists():
dctx = zstandard.ZstdDecompressor()
commit_coverage = json.loads(dctx.decompress(blob.download_as_bytes()))
commit_coverage = json.loads(
dctx.decompress(blob.download_as_bytes(raw_download=True))
)
else:
commit_coverage = {}

Expand Down
6 changes: 3 additions & 3 deletions bot/tests/test_commit_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def upload_from_string(self, val):
nonlocal uploaded_data
uploaded_data = val

def download_as_bytes(self):
def download_as_bytes(self, raw_download=False):
assert False

def patch(self):
Expand Down Expand Up @@ -175,7 +175,7 @@ def upload_from_string(self, val):
nonlocal uploaded_data
uploaded_data = val

def download_as_bytes(self):
def download_as_bytes(self, raw_download=False):
assert False

def patch(self):
Expand Down Expand Up @@ -322,7 +322,7 @@ def upload_from_string(self, val):
nonlocal uploaded_data
uploaded_data = val

def download_as_bytes(self):
def download_as_bytes(self, raw_download=False):
return zstandard.ZstdCompressor().compress(
json.dumps(
{
Expand Down

0 comments on commit 26619b2

Please sign in to comment.