本文整理汇总了Python中glusto.core.Glusto.store_config方法的典型用法代码示例。如果您正苦于以下问题:Python Glusto.store_config方法的具体用法?Python Glusto.store_config怎么用?Python Glusto.store_config使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类glusto.core.Glusto
的用法示例。
在下文中一共展示了Glusto.store_config方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_yaml_noext
# 需要导入模块: from glusto.core import Glusto [as 别名]
# 或者: from glusto.core.Glusto import store_config [as 别名]
def test_yaml_noext(self):
"""Testing yaml config file without extension"""
print "Running: %s - %s" % (self.id(), self.shortDescription())
g.show_config(self.config)
# write the config files
g.store_config(self.config, self.yaml_file)
self.assertTrue(os.path.exists(self.yaml_file))
g.store_config(self.config, self.yaml_noext, config_type='yaml')
self.assertTrue(os.path.exists(self.yaml_noext))
print "--------------"
g.show_file(self.yaml_file)
print "--------------"
g.show_file(self.yaml_noext)
print "--------------"
# read the config file
config = g.load_config(self.yaml_file)
g.show_config(config)
self.assertEqual(config['defaults']['this'], 'yada1')
self.assertEqual(config['defaults']['that'], 'yada2')
self.assertEqual(config['globals']['the_other'], 'yada3')
config_noext = g.load_config(self.yaml_noext, config_type='yaml')
g.show_config(config_noext)
self.assertEqual(config_noext['defaults']['this'], 'yada1')
self.assertEqual(config_noext['defaults']['that'], 'yada2')
self.assertEqual(config_noext['globals']['the_other'], 'yada3')
self.assertEqual(config, config_noext, 'config files are not the same')
示例2: test_ini
# 需要导入模块: from glusto.core import Glusto [as 别名]
# 或者: from glusto.core.Glusto import store_config [as 别名]
def test_ini(self):
"""Testing ini config file(s)"""
print "Running: %s - %s" % (self.id(), self.shortDescription())
g.store_config(self.config, self.ini_file)
self.assertTrue(os.path.exists(self.ini_file))
# read the config file
config = g.load_config(self.ini_file)
g.show_config(config)
self.assertEqual(config['defaults']['this'], 'yada1')
self.assertEqual(config['defaults']['that'], 'yada2')
self.assertEqual(config['defaults']['this_and_that'],
'yada1 and yada2')
self.assertEqual(config['globals']['the_other'], 'yada3')
示例3: test_yaml
# 需要导入模块: from glusto.core import Glusto [as 别名]
# 或者: from glusto.core.Glusto import store_config [as 别名]
def test_yaml(self):
"""Testing yaml config file"""
print "Running: %s - %s" % (self.id(), self.shortDescription())
# write the config file
g.store_config(self.config, self.yaml_file)
# TODO: does unittest have a file exists assert?
self.assertTrue(os.path.exists(self.yaml_file))
# read the config file
config = g.load_config(self.yaml_file)
g.show_config(config)
self.assertEqual(config['defaults']['this'], 'yada1')
self.assertEqual(config['defaults']['that'], 'yada2')
self.assertEqual(config['globals']['the_other'], 'yada3')