def load_plugin_templates(self, klass): plug_filename = klass.__module__.split('.')[-1] + '.plug' plug_file_path = (Path(__file__).parent / '..' / 'plugins' / plug_filename) with plug_file_path.open() as plugfile: plug_info = PluginInfo.load_file(plugfile, plug_file_path) self.plug_files[klass.__name__] = plug_info add_plugin_templates_path(plug_info)
def test_doc(): f = StringIO(""" [Core] Name = Config Module = config [Documentation] Description = something """) assert PluginInfo.load_file(f, None).doc == 'something'
def test_python_version_parse(test_input, expected): f = StringIO(""" [Core] Name = Config Module = config [Python] Version = %s """ % test_input) assert PluginInfo.load_file(f, None).python_version == expected
def test_errbot_version(): f = StringIO(""" [Core] Name = Config Module = config [Errbot] Min = 1.2.3 Max = 4.5.6-beta """) info = PluginInfo.load_file(f, None) assert info.errbot_minversion == (1, 2, 3, sys.maxsize) assert info.errbot_maxversion == (4, 5, 6, 0)