9 from cubicweb.devtools import ApptestConfiguration |
9 from cubicweb.devtools import ApptestConfiguration |
10 |
10 |
11 def unabsolutize(path): |
11 def unabsolutize(path): |
12 parts = path.split(os.sep) |
12 parts = path.split(os.sep) |
13 for i, part in reversed(tuple(enumerate(parts))): |
13 for i, part in reversed(tuple(enumerate(parts))): |
14 if part in ('cubicweb', 'cubes', 'cubes'): |
14 if part.startswith('cubicweb') or part == 'cubes': |
15 return '/'.join(parts[i+1:]) |
15 return '/'.join(parts[i+1:]) |
16 raise Exception('duh? %s' % path) |
16 raise Exception('duh? %s' % path) |
17 |
17 |
18 class CubicWebConfigurationTC(TestCase): |
18 class CubicWebConfigurationTC(TestCase): |
19 def setUp(self): |
19 def setUp(self): |
20 self.config = ApptestConfiguration('data') |
20 self.config = ApptestConfiguration('data') |
21 self.config._cubes = ('email', 'file') |
21 self.config._cubes = ('email', 'file') |
|
22 |
|
23 def tearDown(self): |
|
24 os.environ.pop('CW_CUBES_PATH', None) |
22 |
25 |
23 def test_reorder_cubes(self): |
26 def test_reorder_cubes(self): |
24 # jpl depends on email and file and comment |
27 # jpl depends on email and file and comment |
25 # email depends on file |
28 # email depends on file |
26 self.assertEquals(self.config.reorder_cubes(['file', 'email', 'jpl']), |
29 self.assertEquals(self.config.reorder_cubes(['file', 'email', 'jpl']), |