Skip to content

Commit

Permalink
fix: remove return statement causing checks to be skipped
Browse files Browse the repository at this point in the history
  • Loading branch information
wpbonelli committed Dec 11, 2023
1 parent c3e71f1 commit ac85f0c
Showing 1 changed file with 48 additions and 48 deletions.
96 changes: 48 additions & 48 deletions autotest/framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@

import flopy
import numpy as np
from common_regression import (get_mf6_comparison, get_mf6_files,
get_namefiles, setup_mf6, setup_mf6_comparison)
from flopy.utils.compare import compare_heads
from modflow_devtools.executables import Executables
from modflow_devtools.misc import get_ostag, is_in_ci

from common_regression import (get_mf6_comparison, get_mf6_files,
get_namefiles, setup_mf6, setup_mf6_comparison)

DNODATA = 3.0e30
EXTS = {
"hds": "head",
Expand Down Expand Up @@ -827,53 +826,54 @@ def run(self):
# try to autodetect comparison type if enabled
if self.compare == "auto":
self.compare = get_mf6_comparison(self.workspace)
if not self.compare:
warn("Could not detect comparison type, aborting comparison")
return

# copy reference model files if mf6 regression
if self.compare == "mf6_regression":
cmp_path = self.workspace / self.compare
if os.path.isdir(cmp_path):
shutil.rmtree(cmp_path)
shutil.copytree(self.workspace, cmp_path)

# run comparison model, don't compare results
run_only = self.compare == "run_only"

# todo: don't hardcode workspace / assume agreement with test case
# simulation workspace, store/access sim/model workspaces directly
workspace = (
self.workspace / "mf6"
if run_only
else self.workspace / self.compare
)
if self.compare:
# copy reference model files if mf6 regression
if self.compare == "mf6_regression":
cmp_path = self.workspace / self.compare
if os.path.isdir(cmp_path):
shutil.rmtree(cmp_path)
shutil.copytree(self.workspace, cmp_path)

# run comparison model, don't compare results
run_only = self.compare == "run_only"

# todo: don't hardcode workspace / assume agreement with test case
# simulation workspace, store/access sim/model workspaces directly
workspace = (
self.workspace / "mf6"
if run_only
else self.workspace / self.compare
)

# look up the target executable, can be
# - mf2005
# - mfnwt
# - mfusg
# - mflgr
# - libmf6
# - mf6
# - mf6_regression
exe = self.targets.get(
self.compare.lower().replace(".cmp", ""),
self.targets.mf6,
)
# look up the target executable, can be
# - mf2005
# - mfnwt
# - mfusg
# - mflgr
# - libmf6
# - mf6
# - mf6_regression
exe = self.targets.get(
self.compare.lower().replace(".cmp", ""),
self.targets.mf6,
)

# run comparison model
assert self.run_comparison_model(
workspace=workspace,
exe=exe,
), "comparison model(s) failed"

# compare model results, if enabled
if not run_only:
# if mf6 or mf6 regression test, get output files
if "mf6" in self.compare:
_, self.coutp = get_mf6_files(self.workspace / "mfsim.nam")
self.compare_output(self.compare)
# run comparison model
assert self.run_comparison_model(
workspace=workspace,
exe=exe,
), "comparison model(s) failed"

# compare model results, if enabled
if not run_only:
# if mf6 or mf6 regression test, get output files
if "mf6" in self.compare:
_, self.coutp = get_mf6_files(
self.workspace / "mfsim.nam"
)
self.compare_output(self.compare)
else:
warn("Could not detect comparison type, aborting comparison")

# check results, if enabled
if self.check:
Expand Down

0 comments on commit ac85f0c

Please sign in to comment.