config_file_handler module¶
Description¶
This module contains all the code for searching for, caching, and implementing config files.
-
pytest_helper.config_file_handler.
get_config
(calling_mod, calling_mod_dir, disable=False)[source]¶ Return the configuration corresponding to the module
calling_mod
. Return an empty dict if no config is found. Caches its values in the namespace of the modules (in the pytest-helper data dict). Also caches config files based on their pathnames. If nothing is found in the cache, it looks for the file and reads it in if possible. Ifdisable
is set for a module thenget_config
will always return an empty config dict for the given module and skip searching for the file.
-
pytest_helper.config_file_handler.
get_config_file_pathname
(calling_mod_dir)[source]¶ Get the full pathname of the configuration file, returning
None
if nothing was found. Go up the directory tree starting atcalling_mod_dir
, taking the first file found with an allowed name. If no package are encountered by the top-level root directory, returnNone
.
-
pytest_helper.config_file_handler.
get_config_value
(config_key, default, calling_mod, calling_mod_dir)[source]¶ Return the config value from the config file corresponding to the key
config_key
. Return the valuedefault
if no config value is set. This is called in the main functions to get defaults.