blob: 1b0ae31d207af2bb3c40492539baf9937fe86b7f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
import unittest
import sys
import os
import sos.policyredhat
from sos.helpers import *
class testPluginSanity(unittest.TestCase):
def setUp(self):
self.policy = sos.policyredhat.SosPolicy()
# build plugins list
paths = sys.path
for path in paths:
if path.strip()[-len("site-packages"):] == "site-packages" \
and os.path.isdir(path + "/sos/plugins"):
pluginpath = path + "/sos/plugins"
self.plugins = os.listdir(pluginpath)
self.plugins.sort()
def test_plugin_load(self):
for plug in self.plugins:
plugbase = plug[:-3]
if not plug[-3:] == '.py' or plugbase == "__init__":
continue
try:
loadPlugin = importPlugin("sos.plugins." + plugbase, plugbase)
except:
self.fail("Plugin exception on %s" % (plugbase,))
if __name__=="__main__":
suite = unittest.TestLoader().loadTestsFromTestCase(testPluginSanity)
unittest.TextTestRunner(verbosity=2).run(suite)
|