def test_load_conf_from_env(self, getenv_mocked, ConfigParserMocked): filepath = '/path/to/config/file.ini' getenv_mocked.return_value = filepath load_conf_from_file() ConfigParserMocked.assert_called_once_with(filepath)
def generate_env(engine_path, python): engine_type = load_conf_from_file(engine_path + '/marvin.ini').get('type') dir_ = os.path.basename(os.path.abspath(engine_path)) venv_name = _create_virtual_env(dir_, engine_path, python) _call_make_env(venv_name, engine_type) print('\nDone!!!!') print('Now to workon in the new engine project use: workon {}'.format(venv_name))
def test_load_conf_from_default_path_with_invalid_section(self, ConfigParserGetItemMocked, logger_mocked): from configparser import NoSectionError filepath = '/path/to/config/file.ini' ConfigParserGetItemMocked.side_effect = NoSectionError('') assert len(load_conf_from_file(filepath, section='invalidsection')) == 0 logger_mocked.warn.assert_called_once_with( "Couldn't find \"invalidsection\" section in \"/path/to/config/file.ini\"" )
def test_load_conf_from_default_path_with_invalid_section( self, ConfigParserMocked): from ConfigParser import NoSectionError ConfigParserMocked.return_value.items.side_effect = NoSectionError('') assert len(load_conf_from_file(section='invalidsection')) == 0
def test_load_conf_from_default_path(self, ConfigParserMocked): load_conf_from_file() ConfigParserMocked.assert_called_once_with(DEFAULT_CONFIG_PATH)
def test_load_conf_from_file(self, ConfigParserMocked): filepath = '/path/to/config/file.ini' load_conf_from_file(filepath) ConfigParserMocked.assert_called_once_with(filepath)