-
Notifications
You must be signed in to change notification settings - Fork 256
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove URL validation from requirement parsing
The scheme and path validation logic limits how users of the library can provide URL support. This limitation is lifted, and dependants now need to implement their own URL validation logic they see fit.
- Loading branch information
Showing
4 changed files
with
12 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,6 +78,7 @@ | |
("git+https://git.example.com/MyProject.git@master", ""), | ||
("git+https://git.example.com/[email protected]", ""), | ||
("git+https://git.example.com/MyProject.git@refs/pull/123/head", ""), | ||
("gopher:/foo/com", ""), | ||
(None, "==={ws}arbitrarystring"), | ||
(None, "({ws}==={ws}arbitrarystring{ws})"), | ||
(None, "=={ws}1.0"), | ||
|
@@ -164,6 +165,8 @@ def test_valid_marker(self, marker: str) -> None: | |
[ | ||
"file:///absolute/path", | ||
"file://.", | ||
"file:.", | ||
"file:/.", | ||
], | ||
) | ||
def test_file_url(self, url: str) -> None: | ||
|
@@ -503,25 +506,6 @@ def test_error_invalid_marker_with_invalid_op(self) -> None: | |
" ^" | ||
) | ||
|
||
@pytest.mark.parametrize( | ||
"url", | ||
[ | ||
"gopher:/foo/com", | ||
"file:.", | ||
"file:/.", | ||
], | ||
) | ||
def test_error_on_invalid_url(self, url: str) -> None: | ||
# GIVEN | ||
to_parse = f"name @ {url}" | ||
|
||
# WHEN | ||
with pytest.raises(InvalidRequirement) as ctx: | ||
Requirement(to_parse) | ||
|
||
# THEN | ||
assert "Invalid URL" in ctx.exconly() | ||
|
||
def test_error_on_legacy_version_outside_triple_equals(self) -> None: | ||
# GIVEN | ||
to_parse = "name==1.0.org1" | ||
|