def testSave(self): c = fractconfig.T("testprefs") c.set("compiler", "options", "-foo") self.assertEqual("-foo", c.get("compiler", "options")) c.save() c.set("compiler", "options", "wibble") config2 = fractconfig.T("testprefs") #re-read self.assertEqual("-foo", config2.get("compiler", "options")) os.remove("testprefs")
def testSetList(self): c = fractconfig.T("testprefs") l = ["fish"] c.set_list("map_path", l) l2 = c.get_list("map_path") self.assertEqual(l, l2)
def testPrefs(self): compiler = fc.Compiler() prefs = fractconfig.T("testprefs") prefs.set("compiler", "name", "x") prefs.set("compiler", "options", "foo") prefs.set_list("formula_path", ["fish"]) prefs.set_list("map_path", ["wibble"]) compiler.update_from_prefs(prefs) self.assertEqual("x", compiler.compiler_name) self.assertEqual("foo", compiler.flags) self.assertEqual(["fish"], compiler.path_lists[0]) self.assertEqual(["wibble"], compiler.path_lists[3])
def testDataDir(self): c = fractconfig.T("testprefs") datadir = c.get("general", "data_dir") self.assertEqual(os.path.expandvars("${HOME}/gnofract4d"), datadir)
def testSetSize(self): c = fractconfig.T("testprefs") c.set_size(871, 313) self.assertEqual(871, c.getint("display", "width")) self.assertEqual(313, c.getint("display", "height"))
def testGetList(self): c = fractconfig.T("testprefs") l = c.get_list("map_path") self.assertEqual(4, len(l)) self.assertEqual("maps", l[0])
def testGetDefaults(self): c = fractconfig.T("testprefs") self.assertEqual("gcc", c.get("compiler", "name"))
def testCreate(self): c = fractconfig.T("testprefs")