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

Downgrade log level for configuration defaults message #1894

Merged
merged 2 commits into from
Jul 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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: 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}'.")
Copy link
Member Author

@atugushev atugushev Jun 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: It looks like there is no integration test for the config option. See the warning:

image

Copy link
Member Author

@atugushev atugushev Jun 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 3925b41


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
Loading