def import_repository_details(yaml_file): """ Reads and extracts repository information from a yaml file """ yaml_dict = read_yaml(yaml_file) repositories = parse_repository_details(yaml_dict) return repositories
def from_yaml_file(cls, yaml_file): """ User can make a ValidationWorkflow from a yaml-file that defines the validation tests to be applied within that Workflow. :param yaml_file A file that defines the validation tests. The file should be of the form: test1: input_file: some_file expected_md5sum: some_hash_code :return: A ValidationWorkflow object. """ return cls.from_yaml_dict(read_yaml(yaml_file))
def run_workflow(yaml_path): """ Checks that every directory mentioned in the yaml file is really a directory :param yaml_path: a file-path :return: """ dirs = read_yaml(yaml_path) for current_dir in dirs: if not os.path.expanduser(current_dir) == current_dir: print( "Don't use tilde `~` in dirnames in `validate_dir_existence.py`", file=sys.stderr, ) raise Exception() if not os.path.isdir(current_dir): raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), current_dir)
def test_empty_yaml(self, m): assert read_yaml("some_file") == {}
def test_nonempty_yaml(self, m): assert read_yaml("some_file") == { "repo1": repo_dict1(), "repo2": repo_dict2() }