Skip to content

Commit

Permalink
Enforce file:/// scheme and no netloc [integration]
Browse files Browse the repository at this point in the history
  • Loading branch information
agriyakhetarpal committed Jan 29, 2025
1 parent ce93c45 commit f1de916
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions micropip/wheelinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def from_url(cls, url: str) -> "WheelInfo":
"""
parsed_url = urlparse(url)
if not parsed_url.scheme:

Check warning on line 72 in micropip/wheelinfo.py

View check run for this annotation

Codecov / codecov/patch

micropip/wheelinfo.py#L72

Added line #L72 was not covered by tests
url = "file:///" + url
parsed_url = ParseResult(

Check warning on line 74 in micropip/wheelinfo.py

View check run for this annotation

Codecov / codecov/patch

micropip/wheelinfo.py#L74

Added line #L74 was not covered by tests
scheme="file",
netloc=parsed_url.netloc,
Expand Down
3 changes: 2 additions & 1 deletion tests/test_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ def test_parse_wheel_url1(protocol, path):
url = protocol + path
wheel = WheelInfo.from_url(url)

check_url = url if protocol else "file:///" + path
assert wheel.name == "snowballstemmer"
assert str(wheel.version) == "2.0.0"
assert wheel.sha256 is None
assert wheel.filename == SNOWBALL_WHEEL
assert wheel.url == url
assert wheel.url == check_url
assert wheel.tags == frozenset(
{Tag("py2", "none", "any"), Tag("py3", "none", "any")}
)
Expand Down

0 comments on commit f1de916

Please sign in to comment.