pytest_wdl/utils.py
def tempdir(
    change_dir: bool = False,
    tmproot: Optional[Path] = None,
    cleanup: Optional[bool] = True,
) -> Path:
    """
    Context manager that creates a temporary directory, yields it, and then
    deletes it after return from the yield.

    Args:
        change_dir: Whether to temporarily change to the temp dir.
        tmproot: Root directory in which to create temporary directories.
        cleanup: Whether to delete the temporary directory before exiting the context.
    """
    temp = ensure_path(tempfile.mkdtemp(dir=tmproot))
    try:
        if change_dir:
            with chdir(temp):
                yield temp
        else:
            yield temp
    finally:
        if cleanup:
            shutil.rmtree(temp)

    Context manager that creates a temporary directory, yields it, and then
    deletes it after return from the yield.

    Args:
        change_dir: Whether to temporarily change to the temp dir.
        tmproot: Root directory in which to create temporary directories.
        cleanup: Whether to delete the temporary directory before exiting the context.
    
Context manager that creates a temporary directory, yields it, and then
deletes it after return from the yield.
Context manager that creates a temporary directory yields it and then deletes it after return from the yield .
def tempdir(
    change_dir: bool = False,
    tmproot: Optional[Path] = None,
    cleanup: Optional[bool] = True,
) -> Path:
    temp = ensure_path(tempfile.mkdtemp(dir=tmproot))
    try:
        if change_dir:
            with chdir(temp):
                yield temp
        else:
            yield temp
    finally:
        if cleanup:
            shutil.rmtree(temp)
def tempdir ( change_dir : bool = False , tmproot : Optional [ Path ] = None , cleanup : Optional [ bool ] = True , ) -> Path : temp = ensure_path ( tempfile . mkdtemp ( dir = tmproot ) ) try : if change_dir : with chdir ( temp ) : yield temp else : yield temp finally : if cleanup : shutil . rmtree ( temp )
Context manager that creates a temporary directory, yields it, and then
deletes it after return from the yield.
Context manager that creates a temporary directory yields it and then deletes it after return from the yield .
"""
    Context manager that creates a temporary directory, yields it, and then
    deletes it after return from the yield.

    Args:
        change_dir: Whether to temporarily change to the temp dir.
        tmproot: Root directory in which to create temporary directories.
        cleanup: Whether to delete the temporary directory before exiting the context.
    """
change_dir
bool
Whether to temporarily change to the temp dir.
Whether to temporarily change to the temp dir .
tmproot
Optional[Path]
Root directory in which to create temporary directories.
Root directory in which to create temporary directories .
cleanup
Optional[bool]
Whether to delete the temporary directory before exiting the context.
Whether to delete the temporary directory before exiting the context .