def init_global_conf(): '''Initialize the configuration provider. Allows the configuration to be shared throughout the translator code. The file used is translator.conf, and is within the conf/ directory. It is a standard ini format, and is prcessed using the ConfigParser module. ''' conf_path = os.path.dirname(os.path.abspath(__file__)) conf_file = os.path.join(conf_path, CONF_FILENAME) ConfigProvider._load_config(conf_file)
def test_load_config(self, mock_config_parser): translatorConfig._translator_config.read = mock.MagicMock() translatorConfig._load_config('fake_file.conf') self.assertTrue(translatorConfig._translator_config.read.called)
def reload(*args): func(*args) path = os.path.dirname(os.path.abspath(__file__)) + '/../conf/' conf_file = os.path.join(path, 'translator.conf') translatorConfig._load_config(conf_file)