make_files
- pytest_tmp_files.make_files(root: Path, manifest: dict)[source]
Create the file hierarchy specified by the manifest.
- Parameters:
root – The directory where the files will be created.
manifest – A dictionary describing the files to create. In general, the keys are file paths and the values are file contents. Refer to the File specification for a full description of this dictionary.
Use this function in cases where the
tmp_files
fixture doesn’t make sense.Example
>>> from pathlib import Path >>> from pytest_tmp_files import make_files >>> make_files(Path.cwd(), {'dir/greeting.txt': 'hello world!'}) >>> (Path.cwd() / 'dir' / 'greeting.txt').read_text() 'hello world!'