Skip to content

Commit

Permalink
del(autotest): remove autotest functionality from pymake (#130)
Browse files Browse the repository at this point in the history
ci - update base python version 3.9->3.10. Update mf2005
autotest.
  • Loading branch information
jdhughes-usgs authored Mar 28, 2023
1 parent 077adec commit 6a93306
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 2,530 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Set up Python
uses: actions/[email protected]
with:
python-version: 3.9
python-version: "3.10"

- name: Install python packages
run: |
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pymake-gcc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ jobs:
if: runner.os == 'Linux'
uses: ts-graphviz/setup-graphviz@v1

- name: Set up Python
- name: Setup Python
uses: actions/[email protected]
with:
python-version: 3.9
python-version: "3.10"

- name: Install python packages
run: |
Expand Down Expand Up @@ -79,7 +79,7 @@ jobs:
- name: Set up Python
uses: actions/[email protected]
with:
python-version: 3.9
python-version: "3.10"

- name: Install python packages
run: |
Expand Down Expand Up @@ -120,7 +120,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [ 3.8, 3.7 ]
python-version: [ 3.9, 3.8 ]
defaults:
run:
shell: bash
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pymake-linting-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Set up Python
uses: actions/[email protected]
with:
python-version: 3.9
python-version: "3.10"

- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v1
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:
- name: Setup Python
uses: actions/[email protected]
with:
python-version: 3.9
python-version: "3.10"

- name: Upgrade pip and install build and twine
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pymake-requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Set up Python
uses: actions/[email protected]
with:
python-version: 3.9
python-version: "3.10"

- name: Install python packages
run: |
Expand Down
60 changes: 3 additions & 57 deletions autotest/test_mf2005.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,80 +61,27 @@
pm.cflags = "-O3"


def run_mf2005(namefile, regression=True):
def run_mf2005(namefile):
"""
Run the simulation.
"""
if namefile is not None:
# Set root as the directory name where namefile is located
testname = pymake.get_sim_name(namefile, rootpth=expth)[0]

# Set nam as namefile name without path
nam = os.path.basename(namefile)

# Setup
testpth = os.path.join(dstpth, testname)
pymake.setup(namefile, testpth)

# run test models
exe_name = os.path.abspath(epth)
msg = f"running model...{testname}" + f" using {exe_name}"
msg = f"running model...{nam}" + f" using {exe_name}"
print(msg)
if os.path.exists(exe_name):
success, buff = flopy.run_model(
exe_name, nam, model_ws=testpth, silent=True
exe_name, nam, model_ws=expth, silent=True
)
else:
success = False

assert success, f"base model {nam} " + "did not run."

# If it is a regression run, then setup and run the model with the
# release target and the reference target
success_reg = True
if regression:
testname_reg = os.path.basename(mfpth)
testpth_reg = os.path.join(testpth, testname_reg)
pymake.setup(namefile, testpth_reg)
# exe_name = os.path.abspath(target_previous)
msg = (
"running regression model...{}".format(testname_reg)
+ f" using {exe_name}"
)
print(msg)

if os.path.exists(exe_name):
success_reg, buff = flopy.run_model(
exe_name, nam, model_ws=testpth_reg, silent=False
)
else:
success_reg = False

assert success_reg, f"regression model {nam} " + "did not run."

# compare results
if success and success_reg:
fpth = os.path.split(os.path.join(testpth, nam))[0]
outfile1 = os.path.join(fpth, "bud.cmp")
fpth = os.path.split(os.path.join(testpth, nam))[0]
outfile2 = os.path.join(fpth, "hds.cmp")
success_reg = pymake.compare(
os.path.join(testpth, nam),
os.path.join(testpth_reg, nam),
precision="single",
max_cumpd=0.01,
max_incpd=0.01,
htol=0.001,
outfile1=outfile1,
outfile2=outfile2,
)
# Clean things up
if success_reg:
pymake.teardown(testpth)
else:
success = False
errmsg = f"could not run...{os.path.basename(nam)}"
else:
success = False
errmsg = f"{target} does not exist"
Expand Down Expand Up @@ -186,7 +133,6 @@ def test_compile():


@pytest.mark.regression
@pytest.mark.skipif(sys.platform == "darwin", reason="do not run on OSX")
@pytest.mark.parametrize("fn", name_files)
def test_mf2005(fn):
run_mf2005(fn)
Expand Down
1 change: 0 additions & 1 deletion autotest/test_seawat.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ def build_seawat_dependency_graphs():

if build_graphs:
if os.path.exists(epth):

# build dependencies output directory
if not os.path.exists(deppth):
os.makedirs(deppth, exist_ok=True)
Expand Down
47 changes: 0 additions & 47 deletions pymake/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,6 @@
(:code:`ifort`, :code:`icc`)."""


# autotest
from .autotest.autotest import (
compare,
compare_budget,
compare_concs,
compare_heads,
compare_stages,
compare_swrbudget,
get_entries_from_namefile,
get_input_files,
get_mf6_blockdata,
get_mf6_comparison,
get_mf6_files,
get_mf6_ftypes,
get_mf6_mshape,
get_mf6_nper,
get_namefiles,
get_sim_name,
setup,
setup_comparison,
setup_mf6,
setup_mf6_comparison,
teardown,
)

# pymake
from .config import (
__author__,
Expand Down Expand Up @@ -77,26 +52,4 @@
# plot
"make_plots",
"to_pydot",
# autotest
"setup",
"setup_comparison",
"teardown",
"get_namefiles",
"get_entries_from_namefile",
"get_sim_name",
"get_input_files",
"compare_budget",
"compare_swrbudget",
"compare_heads",
"compare_concs",
"compare_stages",
"compare",
"setup_mf6",
"setup_mf6_comparison",
"get_mf6_comparison",
"get_mf6_files",
"get_mf6_blockdata",
"get_mf6_ftypes",
"get_mf6_mshape",
"get_mf6_nper",
]
3 changes: 0 additions & 3 deletions pymake/autotest/__init__.py

This file was deleted.

Loading

0 comments on commit 6a93306

Please sign in to comment.