68 self.assertEquals([unabsolutize(p) for p in self.config.vregistry_path()], |
70 self.assertEquals([unabsolutize(p) for p in self.config.vregistry_path()], |
69 ['entities', 'web/views', 'sobjects', |
71 ['entities', 'web/views', 'sobjects', |
70 'file/entities.py', 'file/views', 'file/hooks.py', |
72 'file/entities.py', 'file/views', 'file/hooks.py', |
71 'email/entities.py', 'email/views', 'email/hooks.py', |
73 'email/entities.py', 'email/views', 'email/hooks.py', |
72 'test/data/entities.py']) |
74 'test/data/entities.py']) |
73 |
75 |
|
76 def test_cubes_path(self): |
|
77 # make sure we don't import the email cube, but the stdlib email package |
|
78 import email |
|
79 self.assertNotEquals(dirname(email.__file__), self.config.CUBES_DIR) |
|
80 os.environ['CW_CUBES_PATH'] = join(dirname(__file__), 'data', 'cubes') |
|
81 self.assertEquals(self.config.cubes_search_path(), |
|
82 [abspath(join(dirname(__file__), 'data', 'cubes')), |
|
83 self.config.CUBES_DIR]) |
|
84 os.environ['CW_CUBES_PATH'] = '%s%s%s%s%s' % (join(dirname(__file__), 'data', 'cubes'), |
|
85 os.pathsep, self.config.CUBES_DIR, |
|
86 os.pathsep, 'unexistant') |
|
87 # filter out unexistant and duplicates |
|
88 self.assertEquals(self.config.cubes_search_path(), |
|
89 [abspath(join(dirname(__file__), 'data', 'cubes')), |
|
90 self.config.CUBES_DIR]) |
|
91 self.failUnless('mycube' in self.config.available_cubes()) |
|
92 # test cubes python path |
|
93 self.config.adjust_sys_path() |
|
94 import cubes |
|
95 self.assertEquals(cubes.__path__, self.config.cubes_search_path()) |
|
96 # this import should succeed once path is adjusted |
|
97 from cubes import mycube |
|
98 self.assertEquals(mycube.__path__, [abspath(join(dirname(__file__), 'data', 'cubes', 'mycube'))]) |
|
99 # file cube should be overriden by the one found in data/cubes |
|
100 sys.modules.pop('cubes.file', None) |
|
101 del cubes.file |
|
102 from cubes import file |
|
103 self.assertEquals(file.__path__, [abspath(join(dirname(__file__), 'data', 'cubes', 'file'))]) |
|
104 |
|
105 |
74 if __name__ == '__main__': |
106 if __name__ == '__main__': |
75 unittest_main() |
107 unittest_main() |