def profilers(self): """ Returns the names and versions of all profilers loaded in the server. If no profilers are found, an empty list is returned. @return: list of tuples indicating profilers name and version @rtype: list of tuples (str, list of int) """ profiler_dicts = plugin_api.list_profilers() result = [] for d in profiler_dicts: merged = profiler_dicts[d] merged['id'] = d result.append(merged) return result
def profilers(self): """ Returns the names and versions of all profilers loaded in the server. If no profilers are found, an empty list is returned. :return: list of tuples indicating profilers name and version :rtype: list of tuples (str, list of int) """ profiler_dicts = plugin_api.list_profilers() result = [] for d in profiler_dicts: merged = profiler_dicts[d] merged['id'] = d result.append(merged) return result
def test_profilers(self): # listing profilers = api.list_profilers() self.assertEqual(len(profilers), 1) self.assertEqual(profilers, {PROFILER_ID: METADATA}) # list types self.assertEqual(api.list_profiler_types(PROFILER_ID), METADATA) # by id profiler = api.get_profiler_by_id(PROFILER_ID) self.assertFalse(profiler is None) self.assertTrue(isinstance(profiler[0], MockProfiler)) self.assertRaises(PluginNotFound, api.get_profiler_by_id, 'not-valid') # by type profiler = api.get_profiler_by_type(TYPES[0]) self.assertFalse(profiler is None) self.assertTrue(isinstance(profiler[0], MockProfiler)) self.assertRaises(PluginNotFound, api.get_profiler_by_type, 'not-valid') # is_valid self.assertTrue(api.is_valid_profiler(PROFILER_ID)) self.assertFalse(api.is_valid_profiler('not-valid'))