19 sys.path.insert(1,
"../")
25 from ModuleManager
import *
27 configsample_spec = [
"implementation_id",
"ConfigSample",
28 "type_name",
"ConfigSample",
29 "description",
"Configuration example component",
31 "vendor",
"Shinji Kurihara, AIST",
32 "category",
"example",
33 "activity_type",
"DataFlowComponent",
36 "lang_type",
"script",
38 "conf.default.int_param0",
"0",
39 "conf.default.int_param1",
"1",
40 "conf.default.double_param0",
"0.11",
41 "conf.default.double_param1",
"9.9",
42 "conf.default.str_param0",
"hoge",
43 "conf.default.str_param1",
"dara",
44 "conf.default.vector_param0",
"0.0,1.0,2.0,3.0,4.0",
45 "manager.modules.abs_path_allowed",
"YES",
55 OpenRTM_aist.Manager.instance().shutdownManager()
61 self.mm.load(path+
"/hoge.py",
"echo")
62 self.mm.unload(path+
"/hoge.py")
64 self.mm.load(
"hoge",
"echo")
65 self.mm.unload(
"hoge")
67 self.mm.load(
"hoge.py",
"echo")
68 self.mm.unload(
"hoge.py")
70 self.mm.load(
"./hoge.py",
"echo")
71 self.mm.unload(
"./hoge.py")
87 self.mm.load(path+
"/hoge.py",
"echo")
88 self.mm.symbol(path+
"/hoge.py",
"echo")()
89 self.mm.unload(path+
"/hoge.py")
91 self.mm.load(
"hoge",
"echo")
92 self.mm.symbol(
"hoge",
"echo")()
93 self.mm.unload(
"hoge")
95 self.mm.load(
"hoge.py",
"echo")
96 self.mm.symbol(
"hoge.py",
"echo")()
97 self.mm.unload(
"hoge.py")
101 self.mm.setLoadpath([
"/usr/lib/python/site-packages",
"."])
105 self.mm.setLoadpath([
"/usr/lib/python/site-packages",
"."])
106 self.assertEqual(self.mm.getLoadPath()[0],
"/usr/lib/python/site-packages")
111 self.mm.setLoadpath([
"/usr/lib/python/site-packages",
"."])
112 self.mm.addLoadpath([
"/usr/local/lib/python/site-packages"])
113 self.assertEqual(self.mm.getLoadPath()[0],
"/usr/lib/python/site-packages")
114 self.assertEqual(self.mm.getLoadPath()[-1],
"/usr/local/lib/python/site-packages")
119 self.mm.load(
"hoge",
"echo")
120 self.assertNotEqual(self.mm.getLoadedModules()[0],
None)
125 self.mm.allowAbsolutePath()
130 self.mm.disallowAbsolutePath()
135 self.mm.allowModuleDownload()
140 self.mm.disallowModuleDownload()
145 self.assertEqual(self.mm.findFile(
"hoge",[
"."]),
"hoge")
146 self.assertEqual(self.mm.findFile(
"hoge.py",[
"."]),
"hoge.py")
147 self.assertEqual(self.mm.findFile(
"hogehoge",[
"."]),
"")
152 self.assertEqual(self.mm.fileExist(
"hoge.py"),
True)
153 self.assertEqual(self.mm.fileExist(
"./hoge.py"),
True)
154 self.assertEqual(self.mm.fileExist(
"hoge"),
True)
155 self.assertEqual(self.mm.fileExist(
"./hoge"),
True)
156 self.assertEqual(self.mm.fileExist(
"hogehoge"),
False)
161 self.mm.getInitFuncName(
"hoge.py")
166 self.assertEqual(self.mm._ModuleManager__getRtcProfile(
"./ConfigSample.py"),
None)
167 self.assertEqual(self.mm._ModuleManager__getRtcProfile(
"ConfigSample.py"),
None)
168 self.assertEqual(self.mm._ModuleManager__getRtcProfile(
"ConfigSample"),
None)
173 self.mm.setLoadpath([
".",
"./",
"../"])
174 self.assertNotEqual(self.mm.getLoadableModules(),[])
180 if __name__ ==
'__main__':
def test_addLoadpath(self)
The Properties class represents a persistent set of properties.
def test_getLoadableModules(self)
def test_disallowAbsolutePath(self)
def test_allowModuleDownload(self)
def test_allowAbsolutePath(self)
def test_disallowModuleDownload(self)
def test_getRtcProfile(self)
def test_getLoadPath(self)
def test_setLoadpath(self)
def test_load_unload(self)
def test_getLoadedModules(self)
def test_getInitFuncName(self)