diff --git a/tests/test_cli_compile.py b/tests/test_cli_compile.py index 254680d9b..1b1c0cd5a 100644 --- a/tests/test_cli_compile.py +++ b/tests/test_cli_compile.py @@ -2972,12 +2972,18 @@ def test_config_option(pip_conf, runner, tmp_path, make_config_file): out = runner.invoke(cli, [req_in.as_posix(), "--config", config_file.as_posix()]) assert out.exit_code == 0 - dry_run_message = "Dry-run, so nothing updated" - assert dry_run_message in out.stderr + assert "Dry-run, so nothing updated" in out.stderr + + +def test_no_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(), "--no-config", "--config", config_file.as_posix()] ) assert out.exit_code == 0 - assert dry_run_message not in out.stderr + assert "Dry-run, so nothing updated" not in out.stderr diff --git a/tests/test_cli_sync.py b/tests/test_cli_sync.py index ff48ac4b8..b2f7b4421 100644 --- a/tests/test_cli_sync.py +++ b/tests/test_cli_sync.py @@ -384,10 +384,17 @@ def test_config_option(run, runner, make_config_file): out = runner.invoke(cli, ["--config", config_file.as_posix()]) assert out.exit_code == 1 - dry_run_message = "Would install:" - assert dry_run_message in out.stdout + assert "Would install:" in out.stdout + + +@mock.patch("piptools.sync.run") +def test_no_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, ["--no-config", "--config", config_file.as_posix()]) assert out.exit_code == 0 - assert dry_run_message not in out.stdout + assert "Would install:" not in out.stdout