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

Prevent dry-run log message from being printed with --quiet option #861

Merged
merged 7 commits into from
Aug 12, 2019
Merged
2 changes: 1 addition & 1 deletion piptools/scripts/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,4 +415,4 @@ def cli(
)

if dry_run:
log.warning("Dry-run, so nothing updated.")
log.info("Dry-run, so nothing updated.")
28 changes: 26 additions & 2 deletions tests/test_cli_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,32 @@ def test_quiet_option(runner):
with open("requirements", "w"):
pass
out = runner.invoke(cli, ["--quiet", "-n", "requirements"])
# Pinned requirements result has not been written to output
assert "Dry-run, so nothing updated." == out.stderr.strip()
# Pinned requirements result has not been written to output. (An empty
# out.stderr results in a ValueError raised by Click)
try:
assert "" == out.stderr.strip()
except ValueError:
pass
ddormer marked this conversation as resolved.
Show resolved Hide resolved


def test_dry_run_noisy_option(runner):
with open("requirements", "w"):
pass
out = runner.invoke(cli, ["--dry-run", "-n", "requirements"])
atugushev marked this conversation as resolved.
Show resolved Hide resolved
# Dry-run massage has been written to output
ddormer marked this conversation as resolved.
Show resolved Hide resolved
assert "Dry-run, so nothing updated." in out.stderr.strip()
ddormer marked this conversation as resolved.
Show resolved Hide resolved


def test_dry_run_quiet_option(runner):
with open("requirements", "w"):
pass
out = runner.invoke(cli, ["--dry-run", "--quiet", "-n", "requirements"])
# Dry-run massage has not been written to output. (An empty out.stderr
ddormer marked this conversation as resolved.
Show resolved Hide resolved
# results in a ValueError raised by Click)
try:
assert "Dry-run, so nothing updated." not in out.stderr.strip()
except ValueError:
pass
ddormer marked this conversation as resolved.
Show resolved Hide resolved


def test_generate_hashes_with_editable(runner):
Expand Down