33 |
33 |
34 # @test |
34 # @test |
35 def test_create_configuration(self): |
35 def test_create_configuration(self): |
36 conf = api.Configuration("testmee.confml") |
36 conf = api.Configuration("testmee.confml") |
37 self.assertTrue(conf) |
37 self.assertTrue(conf) |
38 |
|
39 def test_configuration_reduce_ex(self): |
|
40 prj = api.Project(api.Storage('.')) |
|
41 conf = api.Configuration("testmee.confml") |
|
42 prj.add_configuration(conf) |
|
43 tpl = conf.__reduce_ex__(2) |
|
44 self.assertEquals(tpl[2]['_storeint'],prj) |
|
45 self.assertEquals(tpl[2]['path'],'testmee.confml') |
|
46 |
|
47 def test_configuration_pickle(self): |
|
48 remove_if_exists(os.path.join(ROOT_PATH,'temp')) |
|
49 prj = api.Project(api.Storage.open(os.path.join(ROOT_PATH,'temp'), 'w')) |
|
50 conf = api.Configuration("testmee.confml") |
|
51 prj.add_configuration(conf, True) |
|
52 prj.save() |
|
53 dfile = open(os.path.join(ROOT_PATH,'temp/out.dat'), 'w') |
|
54 pickle.dump(conf, dfile) |
|
55 dfile.close() |
|
56 dfile = open(os.path.join(ROOT_PATH,'temp/out.dat')) |
|
57 conf2 = pickle.load(dfile) |
|
58 self.assertEquals(conf2.path,'testmee.confml') |
|
59 self.assertEquals(conf2.name,'testmee_confml') |
|
60 |
|
61 |
38 |
62 def test_get_root_configuration(self): |
39 def test_get_root_configuration(self): |
63 conf = api.Configuration("testmee.confml") |
40 conf = api.Configuration("testmee.confml") |
64 self.assertEquals(conf.get_root_configuration(),conf) |
41 self.assertEquals(conf.get_root_configuration(),conf) |
65 conf.add_configuration(api.Configuration("foo/foo.confml")) |
42 conf.add_configuration(api.Configuration("foo/foo.confml")) |