Merge branch 'issues/665' into 'master'

fix JobsArgument --help output

Closes #665

See merge request pycqa/flake8!434
This commit is contained in:
Anthony Sottile 2020-06-05 19:00:02 +00:00
commit b6d3fcacff
2 changed files with 10 additions and 0 deletions

View file

@ -82,6 +82,10 @@ class JobsArgument:
"{!r} must be 'auto' or an integer.".format(arg),
)
def __str__(self):
"""Format our JobsArgument class."""
return "auto" if self.is_auto else str(self.n_jobs)
def register_default_options(option_manager):
"""Register the default options on our OptionManager.

View file

@ -373,3 +373,9 @@ def test_parse_invalid_jobs_argument(optmanager, capsys):
"'foo' must be 'auto' or an integer.\n"
)
assert expected in output
def test_jobs_argument_str():
"""Test that JobsArgument has a correct __str__."""
assert str(JobsArgument("auto")) == "auto"
assert str(JobsArgument("123")) == "123"