def test_print_information(dumps, information, print_mock): """Verify we print and exit only when we have plugins.""" plugins = [('pycodestyle', '2.0.0'), ('mccabe', '0.5.9')] option_manager = mock.Mock(registered_plugins=set(plugins)) with pytest.raises(SystemExit): debug.print_information( None, None, None, None, option_manager=option_manager, ) print_mock.assert_called_once_with('{}') dumps.assert_called_once_with({}, indent=2, sort_keys=True) information.assert_called_once_with(option_manager)
def test_print_information_no_plugins(dumps, information, print_mock): """Verify we print and exit only when we have plugins.""" plugins = [] option_manager = mock.Mock(registered_plugins=set(plugins)) assert debug.print_information( None, None, None, None, option_manager=option_manager, ) is None assert dumps.called is False assert information.called is False assert print_mock.called is False
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 assert dumps.called is False assert information.called is False assert print_mock.called is False