def test_loadWithExistingFile(self): config_path = _get_config_file_path() if exists(config_path): os.remove(config_path) assert catcher.lastLogRecord is None load() assert catcher.lastLogRecord is not None
def test_setWithoutExistingFile(self): config_path = _get_config_file_path() if exists(config_path): os.remove(config_path) set("lang", "plop") value = get("lang") assert (type(value) is str or type(value) is unicode) and value == "plop"
def test_getAkeyNotPresentInFile(self): config_path = _get_config_file_path() # delete the file if exists(config_path): os.remove(config_path) # create the file set("proxy_port", 42) value = get("proxy_type") assert (type(value) is str or type(value) is unicode) and value == "HTTP"
def test_loadWithoutExistingFile(self): config_path = _get_config_file_path() if exists(config_path): os.remove(config_path) # create a config file set('lang', 'plop') assert catcher.lastLogRecord is None load() assert catcher.lastLogRecord is None assert get('lang') == 'plop'
def test_setWithExistingFile(self): config_path = _get_config_file_path() if exists(config_path): os.remove(config_path) # create the file set("lang", "plop") # overwrite the file set("autorun", True) value = get("lang") assert (type(value) is str or type(value) is unicode) and value == "plop" value = get("autorun") assert type(value) is bool and value
def teardown_module(module): restoreConf(_get_config_file_path()) removeBackup() logger = logging.getLogger() logger.removeHandler(catcher)
def setup_module(module): backupConf(_get_config_file_path()) _logger = logging.getLogger() _logger.addHandler(catcher)