From ffd50f75ebaf9ebf4e56cdc5c8f593143e51e983 Mon Sep 17 00:00:00 2001 From: Phil Tom Date: Mon, 30 Mar 2020 20:47:43 -0500 Subject: [PATCH] DEV-133 update log message --- gdc_maf_tool/defer.py | 11 +++++++---- tox.ini | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/gdc_maf_tool/defer.py b/gdc_maf_tool/defer.py index 165f852..0fe9e80 100644 --- a/gdc_maf_tool/defer.py +++ b/gdc_maf_tool/defer.py @@ -30,21 +30,24 @@ def _realize(self): response = self._provider() response.raise_for_status() - self._validate_checksum(response.content) + self._validate_checksum(response) self._content_position = 0 self._content_length = len(response.content) self._response = response - def _validate_checksum(self, content): + def _validate_checksum(self, response): if not self._md5sum: return hash_md5 = hashlib.md5() # nosec - hash_md5.update(content) + hash_md5.update(response.content) md5 = hash_md5.hexdigest() if self._md5sum != md5: - raise ValueError(f"Failed checksum. Expected {self._md5sum}. Got {md5}.") + raise ValueError( + f"Failed checksum for {response.url}. " + f"Expected {self._md5sum}. Got {md5}." + ) @property def response(self) -> requests.Response: diff --git a/tox.ini b/tox.ini index c1f9413..acc3c5c 100644 --- a/tox.ini +++ b/tox.ini @@ -19,4 +19,4 @@ commands = bandit -r gdc_maf_tool/ bandit -r tests/ flake8 - pytest {posargs: -lv tests/ --cov=gdc-maf-tool --cov-report=html} + pytest {posargs: -lv tests/ --cov=gdc_maf_tool --cov-report=html}