def test_prudic2004t2fmi(): run_flow_model() run_transport_model() d = os.path.join(testdir, testgroup) teardowntest = set_teardown_test() if teardowntest: if os.path.isdir(d): shutil.rmtree(d) return
import flopy except: msg = "Error. FloPy package is not available.\n" msg += "Try installing using the following command:\n" msg += " pip install flopy" raise Exception(msg) import targets from framework import set_teardown_test mf6_exe = os.path.abspath(targets.target_dict["mf6"]) testname = "gwf_disu01" testdir = os.path.join("temp", testname) everything_was_successful = True teardown_test = set_teardown_test() def run_mf6(argv, ws): buff = [] proc = subprocess.Popen(argv, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=ws) result, error = proc.communicate() if result is not None: c = result.decode("utf-8") c = c.rstrip("\r\n") print("{}".format(c)) buff.append(c)
def __init__( self, name, exfunc=None, exe_dict=None, htol=None, pdtol=None, rclose=None, idxsim=None, cmp_verbose=True, require_failure=None, api_func=None, mf6_regression=False, make_comparison=True, ): teardown_test = set_teardown_test() for idx, arg in enumerate(sys.argv): if arg[2:].lower() in list(targets.target_dict.keys()): key = arg[2:].lower() exe0 = targets.target_dict[key] exe = os.path.join(os.path.dirname(exe0), sys.argv[idx + 1]) msg = ("replacing {} executable ".format(key) + '"{}" with '.format(targets.target_dict[key]) + '"{}".'.format(exe)) print(msg) targets.target_dict[key] = exe if exe_dict is not None: if not isinstance(exe_dict, dict): msg = "exe_dict must be a dictionary" assert False, msg keys = list(targets.target_dict.keys()) for key, value in exe_dict.items(): if key in keys: exe0 = targets.target_dict[key] exe = os.path.join(os.path.dirname(exe0), value) msg = ("replacing {} executable ".format(key) + '"{}" with '.format(targets.target_dict[key]) + '"{}".'.format(exe)) print(msg) targets.target_dict[key] = exe msg = sfmt.format("Initializing test", name) print(msg) self.name = name self.exfunc = exfunc self.simpath = None self.inpt = None self.outp = None self.coutp = None self.api_func = api_func self.mf6_regression = mf6_regression self.make_comparison = make_comparison self.action = None # set htol for comparisons if htol is None: htol = 0.001 else: msg = sfmt.format("User specified comparison htol", htol) print(msg) self.htol = htol # set pdtol for comparisons if pdtol is None: pdtol = 0.001 else: msg = sfmt.format( "User specified percent difference comparison pdtol", pdtol) print(msg) self.pdtol = pdtol # set rclose for comparisons if rclose is None: rclose = 0.001 else: msg = sfmt.format( "User specified percent difference comparison rclose", rclose) print(msg) self.rclose = rclose # set index for multi-simulation comparisons self.idxsim = idxsim # set compare verbosity self.cmp_verbose = cmp_verbose # set allow failure self.require_failure = require_failure self.teardown_test = teardown_test self.success = False # set is_ci self.is_CI = running_on_CI() return