Display list of available formatters with help for --format

This commit is contained in:
Albert Tugushev 2022-07-28 22:06:58 +02:00 committed by Anthony Sottile
parent fbb33430e6
commit 48b2919130
8 changed files with 35 additions and 4 deletions

View file

@ -18,6 +18,7 @@ def optmanager():
version="3.0.0",
plugin_versions="",
parents=[],
formatter_names=[],
)
options.register_default_options(option_manager)
return option_manager

View file

@ -406,3 +406,13 @@ The specified config file does not exist: missing.cfg
out, err = capsys.readouterr()
assert out == expected
assert err == ""
def test_format_option_help(capsys):
"""Test that help displays list of available formatters."""
with pytest.raises(SystemExit):
cli.main(["--help"])
out, err = capsys.readouterr()
assert "(default, pylint, quiet-filename, quiet-nothing)" in out
assert err == ""

View file

@ -100,6 +100,7 @@ def test_local_plugin_can_add_option(local_config):
version="123",
plugin_versions="",
parents=[stage1_parser],
formatter_names=[],
)
register_default_options(option_manager)
option_manager.register_plugins(loaded_plugins)