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

Incorrect output on pip-compile upgrade with --dry-run and --quiet flags #845

Closed
atugushev opened this issue Jul 11, 2019 · 2 comments · Fixed by #1592
Closed

Incorrect output on pip-compile upgrade with --dry-run and --quiet flags #845

atugushev opened this issue Jul 11, 2019 · 2 comments · Fixed by #1592
Labels
bug Something is not working logging Related to log or console output

Comments

@atugushev
Copy link
Member

atugushev commented Jul 11, 2019

Environment Versions
  1. OS Type: any
  2. Python version: any
  3. pip version: any
  4. pip-tools version: 3.8.0
Steps to replicate
  1. echo "six" > requirements.in
  2. pip-compile
  3. pip-compile --upgrade --dry-run --quiet
Expected result
  • --dry-run should print changes to stdout/stderr
  • --quiet should suppress "Dry-run, so nothing updated." message
#
# This file is autogenerated by pip-compile
# To update, run:
#
#    pip-compile
#
six==1.12.0
Actual result

But currently it behaves the opposite way:

Dry-run, so nothing updated.

Refs:

@atugushev atugushev added the bug Something is not working label Jul 11, 2019
@atugushev atugushev added the logging Related to log or console output label Nov 22, 2019
@AndydeCleyre
Copy link
Contributor

I think the state now is that the dry run message is indeed suppressed by the quiet flag, but so is the output.

Do we want the dry run flag to effectively bypass the log level for the stderr copy of output? Something like

--- a/piptools/writer.py
+++ b/piptools/writer.py
@@ -245,10 +245,12 @@ class OutputWriter:
     ) -> None:

         for line in self._iter_lines(results, unsafe_requirements, markers, hashes):
-            log.info(line)
             if not self.dry_run:
+                log.info(line)
                 self.dst_file.write(unstyle(line).encode())
                 self.dst_file.write(os.linesep.encode())
+            else:
+                log.log(line)

@AndydeCleyre
Copy link
Contributor

The above change would break two current tests:

  • test_quiet_option
  • test_dry_run_quiet_option

This is because the command

pip-compile --quiet --dry-run

would produce the header comment in stderr, instead of an empty stderr.

That doesn't violate what the tests intend to check for exactly, IMO.

AndydeCleyre added a commit to AndydeCleyre/pip-tools that referenced this issue Apr 4, 2022
- content to stderr
- omit the dry run message

Fixes jazzband#845
AndydeCleyre added a commit that referenced this issue Apr 4, 2022
)

- content to stderr
- omit the dry run message

Fixes #845
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working logging Related to log or console output
Projects
None yet
2 participants