pytest_wdl/fixtures.py
def import_dirs(
    request: FixtureRequest,
    project_root: Union[str, Path],
    import_paths: Optional[Union[str, Path]],
) -> List[Union[str, Path]]:
    """
    Fixture that provides a list of directories containing WDL scripts to make
    avaialble as imports. Uses the file provided by `import_paths` fixture if
    it is not None, otherwise returns a list containing the parent directory
    of the test module.

    Args:
        request: A FixtureRequest object
        project_root: Project root directory
        import_paths: File listing paths to imports, one per line
    """
    if import_paths:
        import_paths = ensure_path(import_paths, canonicalize=True)

        if not import_paths.exists():
            raise FileNotFoundError(f"import_paths file {import_paths} does not exist")

        paths = []

        with open(import_paths, "rt") as inp:
            for path_str in inp.read().splitlines(keepends=False):
                path = Path(path_str)
                if not path.is_absolute():
                    path = ensure_path(project_root / path)
                if not path.exists():
                    raise FileNotFoundError(f"Invalid import path: {path}")
                paths.append(path)

        return paths
    else:
        module_dir = find_project_path(
            "tests", start=Path(request.fspath.dirpath()), return_parent=True
        )

        if module_dir:
            return [module_dir]
        else:
            return []

    Fixture that provides a list of directories containing WDL scripts to make
    avaialble as imports. Uses the file provided by `import_paths` fixture if
    it is not None, otherwise returns a list containing the parent directory
    of the test module.

    Args:
        request: A FixtureRequest object
        project_root: Project root directory
        import_paths: File listing paths to imports, one per line
    
Fixture that provides a list of directories containing WDL scripts to make
avaialble as imports. Uses the file provided by `import_paths` fixture if
it is not None, otherwise returns a list containing the parent directory
of the test module.
Fixture that provides a list of directories containing WDL scripts to make avaialble as imports . Uses the file provided by ` import_paths ` fixture if it is not None otherwise returns a list containing the parent directory of the test module .
def import_dirs(
    request: FixtureRequest,
    project_root: Union[str, Path],
    import_paths: Optional[Union[str, Path]],
) -> List[Union[str, Path]]:
    if import_paths:
        import_paths = ensure_path(import_paths, canonicalize=True)
        if not import_paths.exists():
            raise FileNotFoundError(f"import_paths file {import_paths} does not exist")
        paths = []
        with open(import_paths, "rt") as inp:
            for path_str in inp.read().splitlines(keepends=False):
                path = Path(path_str)
                if not path.is_absolute():
                    path = ensure_path(project_root / path)
                if not path.exists():
                    raise FileNotFoundError(f"Invalid import path: {path}")
                paths.append(path)
        return paths
    else:
        module_dir = find_project_path(
            "tests", start=Path(request.fspath.dirpath()), return_parent=True
        )
        if module_dir:
            return [module_dir]
        else:
            return []
def import_dirs ( request : FixtureRequest , project_root : Union [ str , Path ] , import_paths : Optional [ Union [ str , Path ] ] , ) -> List [ Union [ str , Path ] ] : if import_paths : import_paths = ensure_path ( import_paths , canonicalize = True ) if not import_paths . exists ( ) : raise FileNotFoundError ( f"import_paths file {import_paths} does not exist" ) paths = [ ] with open ( import_paths , "rt" ) as inp : for path_str in inp . read ( ) . splitlines ( keepends = False ) : path = Path ( path_str ) if not path . is_absolute ( ) : path = ensure_path ( project_root / path ) if not path . exists ( ) : raise FileNotFoundError ( f"Invalid import path: {path}" ) paths . append ( path ) return paths else : module_dir = find_project_path ( "tests" , start = Path ( request . fspath . dirpath ( ) ) , return_parent = True ) if module_dir : return [ module_dir ] else : return [ ]
Fixture that provides a list of directories containing WDL scripts to make
avaialble as imports.
Fixture that provides a list of directories containing WDL scripts to make avaialble as imports .
"""
    Fixture that provides a list of directories containing WDL scripts to make
    avaialble as imports. Uses the file provided by `import_paths` fixture if
    it is not None, otherwise returns a list containing the parent directory
    of the test module.

    Args:
        request: A FixtureRequest object
        project_root: Project root directory
        import_paths: File listing paths to imports, one per line
    """
request
FixtureRequest
A FixtureRequest object
A FixtureRequest object
project_root
Union[str, Path]
Project root directory
Project root directory
import_paths
Optional[Union[str, Path]]
File listing paths to imports, one per line
File listing paths to imports one per line