Skip to content

Commit 1658759

Browse files
sirosenwebknjaz
andauthored
Apply suggestions from code review
Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]>
1 parent 56b7497 commit 1658759

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

piptools/_compat/pip_compat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def _is_remote_pip_uri(value: str) -> bool:
191191
The test is performed by trying a URL parse and reading the scheme.
192192
"""
193193
scheme = urllib.parse.urlsplit(value).scheme
194-
return scheme in ("http", "https", "file")
194+
return scheme in {"file", "http", "https"}
195195

196196

197197
def create_wheel_cache(cache_dir: str, format_control: str | None = None) -> WheelCache:

tests/test_cli_compile.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4065,8 +4065,9 @@ def test_url_constraints_are_not_treated_as_file_paths(
40654065
This is a regression test for
40664066
https://github.com/jazzband/pip-tools/issues/2223
40674067
"""
4068-
reqs_in = tmp_path / "requirements.in"
40694068
constraints_url = "https://example.com/files/common_constraints.txt"
4069+
4070+
reqs_in = tmp_path / "requirements.in"
40704071
reqs_in.write_text(
40714072
f"""
40724073
small-fake-a
@@ -4094,19 +4095,19 @@ def fake_url_get(url):
40944095

40954096
with monkeypatch.context() as revertable_ctx:
40964097
revertable_ctx.chdir(tmp_path)
4097-
with mock.patch.object(PipSession, "get", mock_get):
4098-
out = runner.invoke(
4099-
cli,
4100-
[
4101-
"--output-file",
4102-
"-",
4103-
"--quiet",
4104-
"--no-header",
4105-
"--no-emit-options",
4106-
"-r",
4107-
input_path,
4108-
],
4109-
)
4098+
revertable_ctx.setattr(PipSession, "get", mock_get)
4099+
out = runner.invoke(
4100+
cli,
4101+
[
4102+
"--output-file",
4103+
"-",
4104+
"--quiet",
4105+
"--no-header",
4106+
"--no-emit-options",
4107+
"-r",
4108+
input_path,
4109+
],
4110+
)
41104111

41114112
# sanity check, pip should have tried to fetch the constraints
41124113
mock_get.assert_called_once_with(constraints_url)

0 commit comments

Comments
 (0)