Skip to content

Commit

Permalink
Prevent dry-run log message from being printed with --quiet option (#861
Browse files Browse the repository at this point in the history
)
  • Loading branch information
ddormer authored and atugushev committed Aug 12, 2019
1 parent 0e6931a commit 903931f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
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.")
20 changes: 18 additions & 2 deletions tests/test_cli_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,8 +455,24 @@ 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.
assert not out.stderr_bytes


def test_dry_run_noisy_option(runner):
with open("requirements", "w"):
pass
out = runner.invoke(cli, ["--dry-run", "requirements"])
# Dry-run message has been written to output
assert "Dry-run, so nothing updated." in out.stderr.splitlines()


def test_dry_run_quiet_option(runner):
with open("requirements", "w"):
pass
out = runner.invoke(cli, ["--dry-run", "--quiet", "requirements"])
# Dry-run message has not been written to output.
assert not out.stderr_bytes


def test_generate_hashes_with_editable(runner):
Expand Down

0 comments on commit 903931f

Please sign in to comment.