mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-05 12:36:54 +00:00
move from optparse to argparse
This commit is contained in:
parent
03cb85f556
commit
b66ebd7034
30 changed files with 462 additions and 302 deletions
|
|
@ -73,9 +73,10 @@ def test_information(system, pyversion, pyimpl):
|
|||
def test_print_information_no_plugins(dumps, information, print_mock):
|
||||
"""Verify we print and exit only when we have plugins."""
|
||||
option_manager = mock.Mock(registered_plugins=set())
|
||||
assert debug.print_information(
|
||||
None, None, None, None, option_manager=option_manager,
|
||||
) is None
|
||||
action = debug.DebugAction(
|
||||
"--bug-report", dest="bug_report", option_manager=option_manager,
|
||||
)
|
||||
assert action(None, None, None, None) is None
|
||||
assert dumps.called is False
|
||||
assert information.called is False
|
||||
assert print_mock.called is False
|
||||
|
|
@ -91,10 +92,11 @@ def test_print_information(dumps, information, print_mock):
|
|||
manager.PluginVersion('mccabe', '0.5.9', False),
|
||||
]
|
||||
option_manager = mock.Mock(registered_plugins=set(plugins))
|
||||
action = debug.DebugAction(
|
||||
"--bug-report", dest="bug_report", option_manager=option_manager,
|
||||
)
|
||||
with pytest.raises(SystemExit):
|
||||
debug.print_information(
|
||||
None, None, None, None, option_manager=option_manager,
|
||||
)
|
||||
action(None, None, None, None)
|
||||
print_mock.assert_called_once_with('{}')
|
||||
dumps.assert_called_once_with({}, indent=2, sort_keys=True)
|
||||
information.assert_called_once_with(option_manager)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue