Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix non-posix paths with file:// protocol on Windows #2750

Merged
merged 5 commits into from
Jul 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion poetry/installation/chef.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def get_cached_archives_for_link(self, link): # type: (Link) -> List[Link]
links = []
for archive_type in archive_types:
for archive in cache_dir.glob("*.{}".format(archive_type)):
links.append(Link("file://{}".format(str(archive))))
links.append(Link(archive.as_uri()))

return links

Expand Down
10 changes: 6 additions & 4 deletions tests/installation/test_chef.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,19 @@ def test_get_cached_archives_for_link(config, mocker):
),
)

distributions = Path(__file__).parent.parent.joinpath("fixtures/distributions")
mocker.patch.object(
chef,
"get_cache_directory_for_link",
return_value=Path(__file__).parent.parent.joinpath("fixtures/distributions"),
chef, "get_cache_directory_for_link", return_value=distributions,
)

archives = chef.get_cached_archives_for_link(
Link("https://files.python-poetry.org/demo-0.1.0.tar.gz")
)

assert 2 == len(archives)
assert archives
assert set(archives) == {
Link(path.as_uri()) for path in distributions.glob("demo-0.1.0*")
}


def test_get_cache_directory_for_link(config):
Expand Down