Skip to content

Commit

Permalink
Merge pull request #1894 from atugushev/verbose-config-log
Browse files Browse the repository at this point in the history
Downgrade log level for configuration defaults message
  • Loading branch information
atugushev authored Jul 1, 2023
2 parents e8b8ce7 + e625695 commit e14c4cd
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
2 changes: 1 addition & 1 deletion piptools/scripts/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ def cli(
)

if config:
log.info(f"Using pip-tools configuration defaults found in '{config !s}'.")
log.debug(f"Using pip-tools configuration defaults found in '{config !s}'.")

if resolver_name == "legacy":
log.warning(
Expand Down
2 changes: 1 addition & 1 deletion piptools/scripts/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def cli(
sys.exit(2)

if config:
log.info(f"Using pip-tools configuration defaults found in '{config !s}'.")
log.debug(f"Using pip-tools configuration defaults found in '{config !s}'.")

if python_executable:
_validate_python_executable(python_executable)
Expand Down
12 changes: 12 additions & 0 deletions tests/test_cli_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2925,3 +2925,15 @@ def test_compile_recursive_extras(runner, tmp_path, current_resolver):
"""
assert out.exit_code == 0
assert expected == out.stderr


def test_config_option(pip_conf, runner, tmp_path, make_config_file):
config_file = make_config_file("dry-run", True)

req_in = tmp_path / "requirements.in"
req_in.touch()

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

assert out.exit_code == 0
assert "Dry-run, so nothing updated" in out.stderr
13 changes: 13 additions & 0 deletions tests/test_cli_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,3 +372,16 @@ def test_default_python_executable_option(run, runner):
"-r",
]
]


@mock.patch("piptools.sync.run")
def test_config_option(run, runner, make_config_file):
config_file = make_config_file("dry-run", True)

with open(sync.DEFAULT_REQUIREMENTS_FILE, "w") as reqs_txt:
reqs_txt.write("six==1.10.0")

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

assert out.exit_code == 1
assert "Would install:" in out.stdout

0 comments on commit e14c4cd

Please sign in to comment.