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

Pass --cache-dir to --pip-args for backtracking resolver #1827

Merged
merged 4 commits into from
Apr 4, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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: 2 additions & 0 deletions piptools/scripts/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,8 @@ def cli(
pip_args.append("--no-build-isolation")
if resolver_name == "legacy":
pip_args.extend(["--use-deprecated", "legacy-resolver"])
if resolver_name == "backtracking" and cache_dir:
pip_args.extend(["--cache-dir", cache_dir])
pip_args.extend(right_args)

repository: BaseRepository
Expand Down
15 changes: 15 additions & 0 deletions tests/test_cli_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2853,3 +2853,18 @@ def test_raise_error_when_input_and_output_filenames_are_matched(
f"Error: input and output filenames must not be matched: {req_out_path}"
)
assert expected_error in out.stderr.splitlines()


@pytest.mark.network
@backtracking_resolver_only
def test_pass_pip_cache_to_pip_args(tmpdir, runner, current_resolver):
cache_dir = tmpdir.mkdir("cache_dir")

with open("requirements.in", "w") as fp:
fp.write("six==1.15.0")

out = runner.invoke(
cli, ["--cache-dir", str(cache_dir), "--resolver", current_resolver]
)
assert out.exit_code == 0
assert os.listdir(os.path.join(str(cache_dir), "http"))