def test_enumerate_configs_extension(config_dir): """Assert function retrieves only files with the given extension""" results = list(enumerate_configs(config_dir.strpath, '.ini')) assert 'config.cfg' not in results assert 'module.cfg' not in results assert 'extra.ini' in results assert 'README' not in results assert len(results) == 1
def test_enumerate_configs(config_dir): """Assert function retrieves only .cfg files by default""" results = list(enumerate_configs(config_dir.strpath)) assert 'config.cfg' in results assert 'module.cfg' in results assert 'extra.ini' not in results assert 'README' not in results assert len(results) == 2
def print_config(): """Print list of available configurations from default homedir.""" configs = utils.enumerate_configs(DEFAULT_HOMEDIR) print('Config files in %s:' % DEFAULT_HOMEDIR) config = None for config in configs: print('\t%s' % config) if not config: print('\tNone found') print('-------------------------')
def test_enumerate_configs_not_a_directory(): results = list(enumerate_configs('not_a_folder_that_exist')) assert results == []