def get_config(par=None): """Return value of given configuration parameter. If no parameter is given the GetConfig returns all configurations in a python dictionary of current configuration parameter names and their values. Examples -------- .. code-block:: robotframework ${VAL} GetConfig default timeout # Return default timeout value ${VAL} GetConfig # Return all config parameter names and values Parameters ---------- par : str Setting to be fetched """ if par: if not CONFIG.is_value(par): raise ValueError("Parameter {} doesn't exist".format(par)) # Return single configuration value current_config = CONFIG.get_value(par) else: # return whole configuration dictionary current_config = CONFIG.get_all_values() return current_config
def reset_config(par=None): """Reset the value of given parameter to default value. If no parameter is given, reset all parameters configuration parameters to their defaults. Reset also returns the value of the given configuration parameter. If no parameter is given, the ResetConfig returns all configurations in a python dictionary with configuration parameter name and their values. Examples -------- .. code-block:: robotframework ${VAL} ResetConfig default timeout # resets single parameter, and returns value ${VAL} ResetConfig # Resets all parameters, and returns config """ if par: if not CONFIG.is_value(par): raise ValueError("Parameter {} doesn't exist".format(par)) CONFIG.reset_value(par) # Return single configuration value current_config = CONFIG.get_value(par) else: CONFIG.reset_value() # return whole configuration dictionary current_config = CONFIG.get_all_values() return current_config
def reset_config(par=None): r"""Reset the value of given parameter to default value. If no parameter is given, reset all parameters configuration parameters to their defaults. Reset also returns the value of the given configuration parameter. If no parameter is given, the ResetConfig returns all configurations in a python dictionary with configuration parameter name and their values. Examples -------- .. code-block:: robotframework ${VAL} ResetConfig default timeout # resets single parameter, and returns value ${VAL} ResetConfig # Resets all parameters, and returns config Related keywords ---------------- \`GetConfig\`, \`SetConfig\` """ if par: if not CONFIG.is_value(par): raise ValueError("Parameter {} doesn't exist".format(par)) CONFIG.reset_value(par) # if case insensitive was reset, reset xpath if par.lower() == "caseinsensitive": CONFIG.reset_value("ContainingTextMatch") # Return single configuration value current_config = CONFIG.get_value(par) else: CONFIG.reset_value() # return whole configuration dictionary current_config = CONFIG.get_all_values() return current_config