Skip to content

Commit

Permalink
comments addressed
Browse files Browse the repository at this point in the history
  • Loading branch information
csalerno-asml committed Nov 9, 2023
1 parent f765822 commit f5128b6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
6 changes: 3 additions & 3 deletions piptools/scripts/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,9 @@ def cli(
"""
log.verbosity = verbose - quiet

# If `src-files` was not provided as input, but rather as config,
# it will be part of the click Context `ctx`.
# However, is `src_files` is specified, then we want to use that.
# If ``src-files` was not provided as an input, but rather as config,
# it will be part of the click context ``ctx``.
# However, if ``src_files`` is specified, then we want to use that.
if not src_files and ctx.default_map and "src_files" in ctx.default_map:
src_files = ctx.default_map["src_files"]

Expand Down
18 changes: 6 additions & 12 deletions tests/test_cli_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3455,15 +3455,12 @@ def test_use_src_files_from_config_if_option_is_not_specified_from_cli(

config_file = make_config_file("src-files", [foo_in.as_posix()])

with open(req_in, "w") as f:
f.write("small-fake-a==0.1")

with open(foo_in, "w") as f:
f.write("small-fake-b==0.1")
req_in.write_text("small-fake-a==0.1", encoding="utf-8")
foo_in.write_text("small-fake-b==0.1", encoding="utf-8")

out = runner.invoke(cli, ["--config", config_file.as_posix()])

assert out.exit_code == 0
assert out.exit_code == 0, out
assert "small-fake-b" in out.stderr
assert "small-fake-a" not in out.stderr

Expand All @@ -3476,15 +3473,12 @@ def test_use_src_files_from_cli_if_option_is_specified_in_both_config_and_cli(

config_file = make_config_file("src-files", [foo_in.as_posix()])

with open(req_in, "w") as f:
f.write("small-fake-a==0.1")

with open(foo_in, "w") as f:
f.write("small-fake-b==0.1")
req_in.write_text("small-fake-a==0.1", encoding="utf-8")
foo_in.write_text("small-fake-b==0.1", encoding="utf-8")

out = runner.invoke(cli, [req_in.as_posix(), "--config", config_file.as_posix()])

assert out.exit_code == 0
assert out.exit_code == 0, out
assert "small-fake-a" in out.stderr
assert "small-fake-b" not in out.stderr

Expand Down

0 comments on commit f5128b6

Please sign in to comment.