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
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 @@ -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 @@ -458,8 +458,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