@contextlib.contextmanager
def temp_directory():
    directory = tempfile.mkdtemp()
    try:
        yield directory
    finally:
        shutil.rmtree(directory)
Context manager that gives the path to a new temporary directory.
dataset/ETHPy150Open Kozea/WeasyPrint/weasyprint/tests/testing_utils.py/temp_directory