class Test(unittest.TestCase): def setUp(self): self.config = Config("./config.ini") def tearDown(self): pass def test_config(self): assert self.config def test_set_config(self): assert self.config.set_config("common", "host", "127.0.0.1") def test_get_config(self): print self.config.get_config('common', 'host') def test_get_config_list(self): print self.config.get_config_list('common')
def _start(root_path): """ link to start command :param root_path: :return: """ try: path = os.path.join(root_path, settings.MAIN_CONFIG) if not os.path.exists(path): print("[WARN]:[{}] not found.".format(path)) return config = Config(path) settings.CONFIG = config script = config.get_config('settings', 'default') if script: return script else: print("[WARN]:[{}] not found in [{}].".format('default script module name', path)) return except Exception as e: print(e)
def _start(root_path): """ link to start command :param root_path: :return: """ try: path = os.path.join(root_path, settings.MAIN_CONFIG) if not os.path.exists(path): print("[WARN]:[{}] not found.".format(path)) return config = Config(path) settings.CONFIG = config script = config.get_config('settings', 'default') if script: return script else: print("[WARN]:[{}] not found in [{}].".format( 'default script module name', path)) return except Exception as e: print(e)