-
- Notifications
You must be signed in to change notification settings - Fork 541
Add a -q (quiet) option to tox #682
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
Conversation
Sometimes the output of tox in addition to the output of the command(s) tox is running can be a overwhelming and confusing. Allowing users to silence tox's output is incredibly useful in focusing on the command(s)'s output. Resolves tox-dev#256
Codecov Report
@@ Coverage Diff @@ ## master #682 +/- ## ========================================= + Coverage 90.77% 94.6% +3.82% ========================================= Files 11 11 Lines 2373 2426 +53 Branches 402 0 -402 ========================================= + Hits 2154 2295 +141 + Misses 144 131 -13 + Partials 75 0 -75
Continue to review full report at Codecov.
|
| def error(self, msg): | ||
| self.logline("ERROR: " + msg, red=True) | ||
| if self.verbosity >= -1: | ||
| self.logline("ERROR: " + msg, red=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if we should silence error messages...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this would be if someone does tox -qq in other words, really really quiet tox. I think in that case it's fine. If someone does tox -q they still see ERROR messages. Make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea, however I think we should brush up a bit the implementation for better readability of the concept introduced here (for ease of maintenance).
changelog/256.feature.rst Outdated
| @@ -0,0 +1 @@ | |||
| Add a ``-q`` option to progressively silence tox's output. By @sigmavirus24 | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like we needs some better description here, what does progressively exactly means? would prefer to detail what's the interaction between -v and -q; and for what amount what output the users is expected to get
tests/test_config.py Outdated
| config = newconfig(["-vv"], "") | ||
| assert config.option.verbosity == 2 | ||
| | ||
| def test_quiet(self, newconfig): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be a parametrized test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see what you mean. I was basing it off the one above. Great catch.
tox/session.py Outdated
| def verbosity(self): | ||
| if self.session: | ||
| return self.session.config.option.verbosity | ||
| return self.session.config.option.verbosity - self.session.config.option.quiet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First, here I would prefer we rename the verbosity of self.session.config.option.verbosity to something like verbose_level, to not conflict the property concept. Also rename quiet to quiet_level, this would make the two options similarly named, and clearly delimiting from the verbosity concept here.
tox/session.py Outdated
| | ||
| def error(self, msg): | ||
| self.logline("ERROR: " + msg, red=True) | ||
| if self.verbosity >= -1: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This minus one seems kinda arbitrary - at best should be a constant somewhere - however, even better, maybe the verbosity should be an enum instead, and compare it against that.
Use a class to contain named constants to replace all the magic numbers used in the reporter. Further, rename the parsed values from the command-line.
| @gaborbernat I believe I've addressed your requested changes. |
| @sigmavirus24 THANKS :) |
| Thanks for the contribution @sigmavirus24 👍 |
| @nedbat, you're welcome! ❤️ |
Sometimes the output of tox in addition to the output of the command(s)
tox is running can be a overwhelming and confusing. Allowing users to
silence tox's output is incredibly useful in focusing on the
command(s)'s output.
Resolves #256
Thanks for contributing a pull request!
If you are contributing for the first time or provide a trivial fix don't worry too
much about the checklist - we will help you get started.
Contribution checklist:
(also see CONTRIBUTING.rst for details)
in message body
<issue number>.<type>.rstfor example (588.bugfix.rst)<type>is must be one ofbugfix,feature,deprecation,breaking,doc,miscCONTRIBUTORS(preserving alphabetical order)