equal
deleted
inserted
replaced
19 |
19 |
20 import sys |
20 import sys |
21 import os |
21 import os |
22 import tempfile |
22 import tempfile |
23 from os.path import dirname, join, abspath |
23 from os.path import dirname, join, abspath |
|
24 import unittest |
24 |
25 |
25 from logilab.common.modutils import cleanup_sys_modules |
26 from logilab.common.modutils import cleanup_sys_modules |
26 from logilab.common.testlib import (TestCase, unittest_main, |
27 from logilab.common.testlib import with_tempdir |
27 with_tempdir) |
|
28 from logilab.common.changelog import Version |
28 from logilab.common.changelog import Version |
29 |
29 |
30 from cubicweb.devtools import ApptestConfiguration |
30 from cubicweb.devtools import ApptestConfiguration, testlib |
31 from cubicweb.cwconfig import _find_prefix |
31 from cubicweb.cwconfig import _find_prefix |
32 |
32 |
33 def unabsolutize(path): |
33 def unabsolutize(path): |
34 parts = path.split(os.sep) |
34 parts = path.split(os.sep) |
35 for i, part in reversed(tuple(enumerate(parts))): |
35 for i, part in reversed(tuple(enumerate(parts))): |
38 raise Exception('duh? %s' % path) |
38 raise Exception('duh? %s' % path) |
39 |
39 |
40 CUSTOM_CUBES_DIR = abspath(join(dirname(__file__), 'data', 'cubes')) |
40 CUSTOM_CUBES_DIR = abspath(join(dirname(__file__), 'data', 'cubes')) |
41 |
41 |
42 |
42 |
43 class CubicWebConfigurationTC(TestCase): |
43 class CubicWebConfigurationTC(testlib.BaseTestCase): |
|
44 |
44 def setUp(self): |
45 def setUp(self): |
45 cleanup_sys_modules([CUSTOM_CUBES_DIR, ApptestConfiguration.CUBES_DIR]) |
46 cleanup_sys_modules([CUSTOM_CUBES_DIR, ApptestConfiguration.CUBES_DIR]) |
46 self.config = ApptestConfiguration('data', __file__) |
47 self.config = ApptestConfiguration('data', __file__) |
47 self.config._cubes = ('email', 'file') |
48 self.config._cubes = ('email', 'file') |
48 |
49 |
130 del cubes.file |
131 del cubes.file |
131 from cubes import file |
132 from cubes import file |
132 self.assertEqual(file.__path__, [join(CUSTOM_CUBES_DIR, 'file')]) |
133 self.assertEqual(file.__path__, [join(CUSTOM_CUBES_DIR, 'file')]) |
133 |
134 |
134 |
135 |
135 class FindPrefixTC(TestCase): |
136 class FindPrefixTC(unittest.TestCase): |
136 def make_dirs(self, *args): |
137 def make_dirs(self, *args): |
137 path = join(tempfile.tempdir, *args) |
138 path = join(tempfile.tempdir, *args) |
138 if not os.path.exists(path): |
139 if not os.path.exists(path): |
139 os.makedirs(path) |
140 os.makedirs(path) |
140 return path |
141 return path |
229 if venv: |
230 if venv: |
230 os.environ['VIRTUAL_ENV'] = venv |
231 os.environ['VIRTUAL_ENV'] = venv |
231 |
232 |
232 |
233 |
233 if __name__ == '__main__': |
234 if __name__ == '__main__': |
234 unittest_main() |
235 unittest.main() |