def __populate_files(self, files): for file in files: if file.endswith('.yaml'): with open(join(self.test_dir, file), 'w') as f: f.write(str(self.yaml_template)) else: ensure_dir(join(self.test_dir, file))
def action(self, includes: dict, variables: dict) -> tuple: if self.source_file: # read from file resources = variables['RESOURCES_DIR'] out = fill_template_str(read_file(join(resources, fill_template_str(self.source_file, variables))), variables) else: out = fill_template(self.source, variables) if self.dst is None: info(out) else: dst = fill_template(self.dst, variables) path = fill_template(self.path, variables) filename = join(path, dst) file_utils.ensure_dir(os.path.dirname(os.path.abspath(filename))) with open(filename, 'w') as f: f.write(str(out)) return variables, out
def write_report(self, path): file_utils.ensure_dir(path) formatter = formatter_factory(self._format) formatter.format(path, self._data)
def populate_resource(self, file: str, content: str): filename = join(self.test_resources, file) ensure_dir(os.path.dirname(os.path.abspath(filename))) with open(filename, 'w') as f: f.write(content)