def test_register_plugin(self): with patch('unilint.unilint_plugin.UnilintPlugin') as plugin: plugin.get_id.return_value = "bar" plugin.get_depends.return_value = [] register_plugin(plugin) self.assertTrue('bar' in PLUGINS) self.assertEqual(plugin, PLUGINS['bar'])
def test_resolve_plugins_depends(self): with patch('unilint.unilint_plugin.UnilintPlugin') as plugin: with patch('unilint.unilint_plugin.UnilintPlugin') as plugin2: plugin.get_id.return_value = "bar2" register_plugin(plugin) plugin2.get_id.return_value = "pop2" register_plugin(plugin2) plugin2.get_depends.return_value = ["bar2"] self.assertEqual(2, len(resolve_plugins('pop2', '')))
def test_resolve_plugins(self): with patch('unilint.unilint_plugin.UnilintPlugin') as plugin: with patch('unilint.unilint_plugin.UnilintPlugin') as plugin2: plugin.get_id.return_value = "bar1" plugin.get_depends.return_value = [] register_plugin(plugin) plugin2.get_id.return_value = "pop1" plugin2.get_depends.return_value = [] register_plugin(plugin2) self.assertEqual(1, len(resolve_plugins('bar1', ''))) self.assertEqual(2, len(resolve_plugins('bar1,pop1', ''))) self.assertFalse('bar1' in resolve_plugins(None, 'bar1')) self.assertTrue('pop1' in resolve_plugins(None, 'bar1'))
from unilint.unilint_main import register_plugin from unilint.common_source_plugin import CommonSourcePlugin from unilint.python_source_plugin import PythonSourcePlugin from unilint.cpp_source_plugin import CppSourcePlugin from unilint.pep8_plugin import Pep8Plugin from unilint.pyflakes_plugin import PyflakesPlugin from unilint.pylint_plugin import PylintPlugin from unilint.pychecker_plugin import PycheckerPlugin from unilint.cppcheck_plugin import CppcheckPlugin from unilint.cpplint_plugin import CpplintPlugin from unilint.standard_formatters import register_standard_formatters register_standard_formatters() register_plugin(CommonSourcePlugin) register_plugin(PythonSourcePlugin) register_plugin(CppSourcePlugin) register_plugin(Pep8Plugin) register_plugin(PyflakesPlugin) register_plugin(PycheckerPlugin) register_plugin(PylintPlugin) register_plugin(CppcheckPlugin) register_plugin(CpplintPlugin)