diff --git a/piptools/scripts/compile.py b/piptools/scripts/compile.py index 837bb0f23..35476ec4b 100755 --- a/piptools/scripts/compile.py +++ b/piptools/scripts/compile.py @@ -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( diff --git a/piptools/scripts/sync.py b/piptools/scripts/sync.py index d504d889a..63e4eb816 100755 --- a/piptools/scripts/sync.py +++ b/piptools/scripts/sync.py @@ -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) diff --git a/tests/test_cli_compile.py b/tests/test_cli_compile.py index 2650af2f6..df677d8d6 100644 --- a/tests/test_cli_compile.py +++ b/tests/test_cli_compile.py @@ -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 diff --git a/tests/test_cli_sync.py b/tests/test_cli_sync.py index 78f5637d1..e7ec3c43f 100644 --- a/tests/test_cli_sync.py +++ b/tests/test_cli_sync.py @@ -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