def register_yaml_targets(path): """ scans and registers all valid **YAML** defined targets in `path`. The name of the **YAML** file (without extension) becomes the target name :param str path: a valid directory """ global __TARGETS__ for name, yaml_file in yaml_files(path): if os.path.basename(yaml_file) == GLOBAL_CONFIG_FILE: continue debug('registering : {0}'.format(name)) __TARGETS__[name] = partial(load_target, yaml_file)
def test_yaml_files(): with tempfile.NamedTemporaryFile(suffix='.yaml') as a_file: files = list(yaml_files(tempfile.gettempdir())) assert len(files) == 1