Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Ckarles committed Sep 12, 2022
1 parent ae23cf6 commit b4758d8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
6 changes: 2 additions & 4 deletions src/poetry/installation/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -661,18 +661,16 @@ def _validate_archive_hash(archive: Path, package: Package) -> str:
known_hashes = {f["hash"] for f in package.files}

for known_hash in known_hashes:
hash_name, known_hash_value = known_hash.split(':', 1)
hash_name, known_hash_value = known_hash.split(":", 1)
archive_hash_value = file_dep.hash(hash_name=hash_name)

if known_hash_value == archive_hash_value:
return f"{hash_name}:{archive_hash_value}"

raise RuntimeError(
f"Hash for {package} from archive {archive.name} not found in"
f" known hashes"
f"Hash for {package} from archive {archive.name} not found in known hashes"
)


def _download_archive(self, operation: Install | Update, link: Link) -> Path:
response = self._authenticator.request(
"get", link.url, stream=True, io=self._sections.get(id(operation), self._io)
Expand Down
10 changes: 5 additions & 5 deletions tests/installation/test_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,10 +646,10 @@ def test_executor_should_write_pep610_url_references_for_git_with_subdirectories
@pytest.mark.parametrize(
"file_hash",
[
("sha256:70e704135718fffbcbf61ed1fc45933cfd86951a744b681000eaaa75da31f17a"),
("md5:15507846fd4299596661d0197bfb4f90"),
("sha512:44cfa6b8696e5008c1c4dfe32c52a8b6511c261d8f3a25882366c0718eb42a17da5e4b9196623597661871be65c48e613d8f5c50a5c5c827e0efbf8b612fe5be"), # noqa: E501
]
"sha256:70e704135718fffbcbf61ed1fc45933cfd86951a744b681000eaaa75da31f17a",
"md5:15507846fd4299596661d0197bfb4f90",
"sha512:44cfa6b8696e5008c1c4dfe32c52a8b6511c261d8f3a25882366c0718eb42a17da5e4b9196623597661871be65c48e613d8f5c50a5c5c827e0efbf8b612fe5be", # noqa: E501
],
)
def test_executor_should_use_cached_link_and_hash(
tmp_venv: VirtualEnv,
Expand All @@ -658,7 +658,7 @@ def test_executor_should_use_cached_link_and_hash(
io: BufferedIO,
mocker: MockerFixture,
fixture_dir: FixtureDirGetter,
file_hash,
file_hash: str,
):
link_cached = fixture_dir("distributions") / "demo-0.1.0-py2.py3-none-any.whl"

Expand Down

0 comments on commit b4758d8

Please sign in to comment.