tests/conftest.py
def check_filesystem(
        base_path, directories=None, files=None, check_all=True
    ):
        """
        Check the filesystem at a given path to make sure that the listed files
        and/or directories all exist

        Args:
            base_path (str): The base path to search from
            directories (list, optional): List of directories to search.
                Defaults to None.
            files (list, optional): List of files to search. Defaults to None.
            check_all (bool, optional): Check if there are extra files/directories
                from the ones listed. Defaults to True.

        Returns:
            Tuple: (list of missing files/dirs, list of extra files/dirs)
        """
        # pylint: disable=too-many-branches
        assert (
            directories is not None or files is not None
        ), "One of directories or files must be specified"

        assert (
            isinstance(files, list) or files is None
        ), "Argument must be list of files to search for"
        assert (
            isinstance(directories, list) or directories is None
        ), "Argument must be list of directories to search for"

        missing_files = []
        extra_files = []

        if files is not None:
            full_files = []
            for filename in files:
                filepath = os.path.join(base_path, filename)
                full_files.append(filepath)
                if not os.path.exists(filepath):
                    missing_files.append(filename)

        if directories is not None:
            full_directories = []
            for dirname in directories:
                dirpath = os.path.join(base_path, dirname)
                full_directories.append(dirpath)
                if not os.path.exists(dirpath):
                    missing_files.append(dirname)

        if check_all:
            for dirpath, _, f_files in os.walk(base_path):
                if directories is not None:
                    if dirpath not in full_directories:
                        if dirpath != base_path:
                            extra_files.append(dirpath)
                if files is not None:
                    for f in f_files:
                        filepath = os.path.join(dirpath, f)
                        if filepath not in full_files:
                            extra_files.append(filepath)

        return missing_files, extra_files

        Check the filesystem at a given path to make sure that the listed files
        and/or directories all exist

        Args:
            base_path (str): The base path to search from
            directories (list, optional): List of directories to search.
                Defaults to None.
            files (list, optional): List of files to search. Defaults to None.
            check_all (bool, optional): Check if there are extra files/directories
                from the ones listed. Defaults to True.

        Returns:
            Tuple: (list of missing files/dirs, list of extra files/dirs)
        
Check the filesystem at a given path to make sure that the listed files
and/or directories all exist
Check the filesystem at a given path to make sure that the listed files and / or directories all exist
def check_filesystem(
        base_path, directories=None, files=None, check_all=True
    ):
        assert (
            directories is not None or files is not None
        ), "One of directories or files must be specified"
        assert (
            isinstance(files, list) or files is None
        ), "Argument must be list of files to search for"
        assert (
            isinstance(directories, list) or directories is None
        ), "Argument must be list of directories to search for"
        missing_files = []
        extra_files = []
        if files is not None:
            full_files = []
            for filename in files:
                filepath = os.path.join(base_path, filename)
                full_files.append(filepath)
                if not os.path.exists(filepath):
                    missing_files.append(filename)
        if directories is not None:
            full_directories = []
            for dirname in directories:
                dirpath = os.path.join(base_path, dirname)
                full_directories.append(dirpath)
                if not os.path.exists(dirpath):
                    missing_files.append(dirname)
        if check_all:
            for dirpath, _, f_files in os.walk(base_path):
                if directories is not None:
                    if dirpath not in full_directories:
                        if dirpath != base_path:
                            extra_files.append(dirpath)
                if files is not None:
                    for f in f_files:
                        filepath = os.path.join(dirpath, f)
                        if filepath not in full_files:
                            extra_files.append(filepath)
        return missing_files, extra_files
def check_filesystem ( base_path , directories = None , files = None , check_all = True ) : assert ( directories is not None or files is not None ) , "One of directories or files must be specified" assert ( isinstance ( files , list ) or files is None ) , "Argument must be list of files to search for" assert ( isinstance ( directories , list ) or directories is None ) , "Argument must be list of directories to search for" missing_files = [ ] extra_files = [ ] if files is not None : full_files = [ ] for filename in files : filepath = os . path . join ( base_path , filename ) full_files . append ( filepath ) if not os . path . exists ( filepath ) : missing_files . append ( filename ) if directories is not None : full_directories = [ ] for dirname in directories : dirpath = os . path . join ( base_path , dirname ) full_directories . append ( dirpath ) if not os . path . exists ( dirpath ) : missing_files . append ( dirname ) if check_all : for dirpath , _ , f_files in os . walk ( base_path ) : if directories is not None : if dirpath not in full_directories : if dirpath != base_path : extra_files . append ( dirpath ) if files is not None : for f in f_files : filepath = os . path . join ( dirpath , f ) if filepath not in full_files : extra_files . append ( filepath ) return missing_files , extra_files
Check the filesystem at a given path to make sure that the listed files
and/or directories all exist
Check the filesystem at a given path to make sure that the listed files and / or directories all exist
"""
        Check the filesystem at a given path to make sure that the listed files
        and/or directories all exist

        Args:
            base_path (str): The base path to search from
            directories (list, optional): List of directories to search.
                Defaults to None.
            files (list, optional): List of files to search. Defaults to None.
            check_all (bool, optional): Check if there are extra files/directories
                from the ones listed. Defaults to True.

        Returns:
            Tuple: (list of missing files/dirs, list of extra files/dirs)
        """ # pylint: disable=too-many-branches
(list of missing files/dirs, list of extra files/dirs)
( list of missing files / dirs list of extra files / dirs )
Tuple
base_path
The base path to search from
The base path to search from
directories
List of directories to search.
Defaults to None.
List of directories to search . Defaults to None .
files
List of files to search. Defaults to None.
List of files to search . Defaults to None .
None
check_all
Check if there are extra files/directories
from the ones listed. Defaults to True.
Check if there are extra files / directories from the ones listed . Defaults to True .