9 _TEST_PLUGIN_PLUGINS_PATH
= os
.environ
['TEST_PLUGIN_PLUGINS_PATH']
12 @unittest.skip("this is broken")
13 class PluginSetTestCase(unittest
.TestCase
):
14 def test_create(self
):
15 pset
= bt2
.find_plugins(_TEST_PLUGIN_PLUGINS_PATH
)
16 self
.assertTrue(len(pset
) >= 3)
18 def test_getitem(self
):
19 pset
= bt2
.find_plugins(_TEST_PLUGIN_PLUGINS_PATH
)
20 self
.assertTrue(pset
[0].path
.startswith(_TEST_PLUGIN_PLUGINS_PATH
))
23 pset
= bt2
.find_plugins(_TEST_PLUGIN_PLUGINS_PATH
)
27 names
.add(plugin
.name
)
29 self
.assertTrue('ctf' in names
)
30 self
.assertTrue('utils' in names
)
31 self
.assertTrue('text' in names
)
34 @unittest.skip("this is broken")
35 class FindPluginsTestCase(unittest
.TestCase
):
36 def test_find_none(self
):
37 pset
= bt2
.find_plugins('/this/does/not/exist/246703df-cb85-46d5-8406-5e8dc4a88b41')
38 self
.assertIsNone(pset
)
40 def test_find_dir(self
):
41 pset
= bt2
.find_plugins(_TEST_PLUGIN_PLUGINS_PATH
)
42 self
.assertTrue(len(pset
) >= 3)
45 @unittest.skip("this is broken")
46 class FindPluginTestCase(unittest
.TestCase
):
47 def test_find_none(self
):
48 plugin
= bt2
.find_plugin('this-does-not-exist-246703df-cb85-46d5-8406-5e8dc4a88b41')
49 self
.assertIsNone(plugin
)
51 def test_find_existing(self
):
52 plugin
= bt2
.find_plugin('ctf')
53 self
.assertIsInstance(plugin
, bt2
.plugin
._Plugin
)
56 @unittest.skip("this is broken")
57 class PluginTestCase(unittest
.TestCase
):
59 self
._plugin
= bt2
.find_plugin('ctf')
65 self
.assertEqual(self
._plugin
.name
, 'ctf')
68 plugin_path
= os
.path
.normcase(self
._plugin
.path
)
69 plugin_path_env
= os
.path
.normcase(_TEST_PLUGIN_PLUGINS_PATH
)
70 self
.assertTrue(plugin_path
.startswith(plugin_path_env
))
72 def test_author(self
):
73 self
.assertTrue('Philippe Proulx' in self
._plugin
.author
)
75 def test_license(self
):
76 self
.assertTrue('MIT' in self
._plugin
.license
)
78 def test_description(self
):
79 self
.assertTrue('CTF source and sink support' in self
._plugin
.description
)
81 def test_version(self
):
82 self
.assertIsNone(self
._plugin
.version
)
84 def test_source_comp_classes_len(self
):
85 self
.assertEqual(len(self
._plugin
.source_component_classes
), 2)
87 def test_source_comp_classes_getitem(self
):
88 self
.assertEqual(self
._plugin
.source_component_classes
['fs'].name
, 'fs')
90 def test_source_comp_classes_getitem_invalid(self
):
91 with self
.assertRaises(KeyError):
92 self
._plugin
.source_component_classes
['lol']
94 def test_source_comp_classes_iter(self
):
97 for cc_name
, cc
in self
._plugin
.source_component_classes
.items():
100 self
.assertTrue('fs' in plugins
)
101 self
.assertTrue('lttng-live' in plugins
)
102 self
.assertEqual(plugins
['fs'].name
, 'fs')
103 self
.assertEqual(plugins
['lttng-live'].name
, 'lttng-live')
105 def test_filter_comp_classes_len(self
):
106 plugin
= bt2
.find_plugin('utils')
107 self
.assertEqual(len(plugin
.filter_component_classes
), 2)
109 def test_sink_comp_classes_len(self
):
110 self
.assertEqual(len(self
._plugin
.sink_component_classes
), 1)