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

Add long --verbose/--quiet cli arguments #1612

Merged
merged 1 commit into from
Jul 12, 2020
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
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Ederag
Eli Collins
Eugene Yunak
Fernando L. Pereira
Florian Bruhin
Florian Preinstorfer
Florian Schulze
George Alton
Expand Down
1 change: 1 addition & 0 deletions docs/changelog/1612.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The long arguments ``--verbose`` and ``--quiet`` (rather than only their short forms, ``-v`` and ``-q``) are now accepted.
2 changes: 2 additions & 0 deletions src/tox/config/reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
def add_verbosity_commands(parser):
parser.add_argument(
"-v",
"--verbose",
action="count",
dest="verbose_level",
default=0,
Expand All @@ -13,6 +14,7 @@ def add_verbosity_commands(parser):
)
parser.add_argument(
"-q",
"--quiet",
action="count",
dest="quiet_level",
default=0,
Expand Down
19 changes: 11 additions & 8 deletions tests/unit/config/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2126,15 +2126,18 @@ def test_notest(self, newconfig):
config = newconfig(["--notest"], "")
assert config.option.notest

def test_verbosity(self, newconfig):
config = newconfig([], "")
assert config.option.verbose_level == 0
config = newconfig(["-v"], "")
assert config.option.verbose_level == 1
config = newconfig(["-vv"], "")
assert config.option.verbose_level == 2
@pytest.mark.parametrize(
"args, expected",
[([], 0), (["-v"], 1), (["-vv"], 2), (["--verbose", "--verbose"], 2), (["-vvv"], 3)],
)
def test_verbosity(self, args, expected, newconfig):
config = newconfig(args, "")
assert config.option.verbose_level == expected

@pytest.mark.parametrize("args, expected", [([], 0), (["-q"], 1), (["-qq"], 2), (["-qqq"], 3)])
@pytest.mark.parametrize(
"args, expected",
[([], 0), (["-q"], 1), (["-qq"], 2), (["--quiet", "--quiet"], 2), (["-qqq"], 3)],
)
def test_quiet(self, args, expected, newconfig):
config = newconfig(args, "")
assert config.option.quiet_level == expected
Expand Down