def get_mf6_models(): """ Get a list of test models """ # determine if running on travis is_CI = "CI" in os.environ # tuple of example files to exclude exclude = ("ex-gwf-csub-p02c", ) # update exclude if is_CI: exclude_CI = (None, ) exclude = exclude + exclude_CI exclude = list(exclude) # write a summary of the files to exclude print("list of tests to exclude:") for idx, ex in enumerate(exclude): print(" {}: {}".format(idx + 1, ex)) # build list of directories with valid example files if example_basedir is not None: example_dirs = get_example_dirs(example_basedir, exclude, prefix="ex-") else: example_dirs = [] # determine if only a selection of models should be run select_dirs = None select_packages = None for idx, arg in enumerate(sys.argv): if arg.lower() == "--sim": if len(sys.argv) > idx + 1: select_dirs = sys.argv[idx + 1:] break elif arg.lower() == "--pak": if len(sys.argv) > idx + 1: select_packages = sys.argv[idx + 1:] select_packages = [item.upper() for item in select_packages] break # determine if the selection of model is in the test models to evaluate if select_dirs is not None: example_dirs = get_select_dirs(select_dirs, example_dirs) if len(example_dirs) < 1: msg = "Selected models not available in test" print(msg) # determine if the specified package(s) is in the test models to evaluate if select_packages is not None: example_dirs = get_select_packages(select_packages, example_basedir, example_dirs) if len(example_dirs) < 1: msg = "Selected packages not available [" for pak in select_packages: msg += " {}".format(pak) msg += "]" print(msg) return example_dirs
def get_mf5to6_models(): """ Get a list of test models """ # list of example files to exclude exclude = (None, ) # write a summary of the files to exclude print("list of tests to exclude:") for idx, ex in enumerate(exclude): print(" {}: {}".format(idx + 1, ex)) # build list of directories with valid example files if example_basedir is not None: example_dirs = get_example_dirs( example_basedir, exclude, prefix="test", find_sim=False, ) else: example_dirs = [] # determine if only a selection of models should be run select_dirs = None select_packages = None for idx, arg in enumerate(sys.argv): if arg.lower() == "--sim": if len(sys.argv) > idx + 1: select_dirs = sys.argv[idx + 1:] break elif arg.lower() == "--pak": if len(sys.argv) > idx + 1: select_packages = sys.argv[idx + 1:] select_packages = [item.upper() for item in select_packages] break # determine if the selection of model is in the test models to evaluate if select_dirs is not None: example_dirs = get_select_dirs(select_dirs, example_dirs) if len(example_dirs) < 1: msg = "Selected models not available in test" print(msg) # determine if the specified package(s) is in the test models to evaluate if select_packages is not None: example_dirs = get_select_packages(select_packages, example_basedir, example_dirs) if len(example_dirs) < 1: msg = "Selected packages not available [" for idx, pak in enumerate(select_packages): msg += "{}".format(pak) if idx + 1 < len(select_packages): msg += ", " msg += "]" print(msg) return example_dirs
def get_mf6_models(): """ Get a list of test models """ # determine if test directory exists dir_avail = is_directory_available(example_basedir) if not dir_avail: return [] # determine if running on travis is_CI = "CI" in os.environ # get current branch if is_CI: branch = os.path.basename(os.environ["GITHUB_REF"]) else: branch = get_branch() print("On branch {}".format(branch)) # tuple of example files to exclude # exclude = (None,) exclude = ("test205_gwtbuy-henrytidal", ) # update exclude if is_CI: exclude_CI = (None, ) exclude = exclude + exclude_CI exclude = list(exclude) # write a summary of the files to exclude print("list of tests to exclude:") for idx, ex in enumerate(exclude): print(" {}: {}".format(idx + 1, ex)) # build list of directories with valid example files if example_basedir is not None: example_dirs = get_example_dirs(example_basedir, exclude, prefix="test") else: example_dirs = [] # exclude dev examples on master or release branches if "master" in branch.lower() or "release" in branch.lower(): drmv = [] for d in example_dirs: if "_dev" in d.lower(): drmv.append(d) for d in drmv: example_dirs.remove(d) # determine if only a selection of models should be run select_example_dirs = None select_packages = None for idx, arg in enumerate(sys.argv): if arg.lower() == "--sim": if len(sys.argv) > idx + 1: select_example_dirs = sys.argv[idx + 1:] break elif arg.lower() == "--pak": if len(sys.argv) > idx + 1: select_packages = sys.argv[idx + 1:] select_packages = [item.upper() for item in select_packages] break elif arg.lower() == "--match": if len(sys.argv) > idx + 1: like = sys.argv[idx + 1] example_dirs = [item for item in example_dirs if like in item] break # determine if the selection of model is in the test models to evaluate if select_example_dirs is not None: example_dirs = get_select_dirs(select_example_dirs, example_dirs) if len(example_dirs) < 1: msg = "Selected models not available in test" print(msg) # determine if the specified package(s) is in the test models to evaluate if select_packages is not None: example_dirs = get_select_packages(select_packages, example_basedir, example_dirs) if len(example_dirs) < 1: msg = "Selected packages not available [" for pak in select_packages: msg += " {}".format(pak) msg += "]" print(msg) return example_dirs