Skip to content

Commit

Permalink
release(1.2.8): update mf6 version
Browse files Browse the repository at this point in the history
Also added latest version of gsflow (v 2.3.0) and mfusg_gsi (v2.1.1).
  • Loading branch information
jdhughes-usgs committed Jul 4, 2023
1 parent 629b57e commit 7241f50
Show file tree
Hide file tree
Showing 19 changed files with 151 additions and 546 deletions.
6 changes: 0 additions & 6 deletions .github/common/download-examples.sh

This file was deleted.

7 changes: 4 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,21 @@ jobs:
.github/common/install-python.sh
- name: Download examples for pytest runs
working-directory: ./autotest
run: |
.github/common/download-examples.sh
pytest -v -n=auto -m="base or regression" --durations=0 ci_setup.py
- name: test on Linux
if: runner.os == 'Linux'
working-directory: ./autotest
run: |
pytest -v -n=auto --dist=loadfile -m="base or regression" --durations=0 --cov=pymake --cov-report=xml
pytest -v -n=auto -m="base or regression" --durations=0 --cov=pymake --cov-report=xml
- name: test on MacOS
if: runner.os == 'macOS'
working-directory: ./autotest
run: |
pytest -v -n=auto --dist=loadfile -m="base" --durations=0 --cov=pymake --cov-report=xml
pytest -v -n=auto -m="base" --durations=0 --cov=pymake --cov-report=xml
- name: test on Windows
if: runner.os == 'Windows'
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/pymake-gcc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,14 @@ jobs:
uses: modflowpy/install-gfortran-action@v1

- name: Download examples for pytest runs
working-directory: ./autotest
run: |
.github/common/download-examples.sh
pytest -v -n=auto -m="regression" --durations=0 ci_setup.py
- name: Run pytest
working-directory: ./autotest
run: |
pytest -v --dist=loadfile -n=auto -m="base or regression" --durations=0 --cov=pymake --cov-report=xml
pytest -v -n=auto -m="base or regression" --durations=0 --cov=pymake --cov-report=xml
- name: Print coverage report before upload
working-directory: ./autotest
Expand Down Expand Up @@ -100,13 +101,14 @@ jobs:
g++ --version
- name: Download examples for pytest runs
working-directory: ./autotest
run: |
.github/common/download-examples.sh
pytest -v -n=auto -m="base" --durations=0 ci_setup.py
- name: Run pytest
working-directory: ./autotest
run: |
pytest -v --dist=loadfile -n=auto -m="base" --durations=0 --cov=pymake --cov-report=xml
pytest -v -n=auto -m="base" --durations=0 --cov=pymake --cov-report=xml
- name: Print coverage report before upload
working-directory: ./autotest
Expand Down Expand Up @@ -152,4 +154,4 @@ jobs:
- name: Run pytest
working-directory: ./autotest
run: |
pytest -v --dist=loadfile -n=auto -m="base" --durations=0
pytest -v -n=auto -m="base" --durations=0
29 changes: 28 additions & 1 deletion autotest/ci_setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import os
import shutil

import pytest
from flaky import flaky

import pymake
from autotest.conftest import get_pymake_appdir

RERUNS = 3

temp_pth = "temp"
if not os.path.exists(temp_pth):
Expand All @@ -10,6 +16,8 @@
if os.path.isdir(mf6_exdir):
shutil.rmtree(mf6_exdir)

targets = ["mf6"]


def download_mf6_examples(verbose=False):
"""Download mf6 examples and return location of folder"""
Expand Down Expand Up @@ -84,6 +92,25 @@ def examples_list(verbose=False):
return


if __name__ == "__main__":
@flaky(max_runs=RERUNS)
@pytest.mark.regression
def test_initialize():
mf6pth = download_mf6_examples(verbose=True)
examples_list(verbose=True)


@flaky(max_runs=RERUNS)
@pytest.mark.regression
@pytest.mark.parametrize("target", targets)
def test_build_apps(function_tmpdir, target):
assert (
pymake.build_apps(
target,
verbose=True,
clean=True,
workingdir=function_tmpdir,
meson=True,
appdir=get_pymake_appdir(),
)
== 0
), f"could not compile {target}"
19 changes: 17 additions & 2 deletions autotest/conftest.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import contextlib
import os
import re
from importlib import metadata
from pathlib import Path

import matplotlib.pyplot as plt
import pytest
from modflow_devtools.misc import is_in_ci

# import modflow-devtools fixtures

Expand All @@ -15,6 +15,21 @@


# misc utilities
@contextlib.contextmanager
def working_directory(path):
"""Changes working directory and returns to previous on exit."""
prev_cwd = os.getcwd()
os.chdir(path)
try:
yield
finally:
os.chdir(prev_cwd)


def get_pymake_appdir():
appdir = Path.home() / ".pymake"
appdir.mkdir(parents=True, exist_ok=True)
return appdir


def get_project_root_path() -> Path:
Expand Down
31 changes: 14 additions & 17 deletions autotest/test_build.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import contextlib
import os
import sys
import time
Expand All @@ -7,30 +6,28 @@
from flaky import flaky

import pymake
from autotest.conftest import working_directory

RERUNS = 3

targets = pymake.usgs_program_data.get_keys(current=True)
targets_make = pymake.usgs_program_data.get_keys(current=True)
for target in targets_make:
if target in ("triangle", "libmf6", "gridgen", "mf2000", "mflgr", "swtv4"):
targets_make.remove(target)


@contextlib.contextmanager
def working_directory(path):
"""Changes working directory and returns to previous on exit."""
prev_cwd = os.getcwd()
os.chdir(path)
try:
yield
finally:
os.chdir(prev_cwd)
targets_make = [
t
for t in pymake.usgs_program_data.get_keys(current=True)
if t
not in (
"triangle",
"libmf6",
"gridgen",
"mf2000",
"mflgr",
"swtv4",
)
]


def build_with_makefile(target, path, fc):
success = True
errmsg = ""
with working_directory(path):
if os.path.isfile("makefile"):
# wait to delete on windows
Expand Down
8 changes: 4 additions & 4 deletions autotest/test_gridgen.py → autotest/test_gridgen_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def run_gridgen(cmd):
return success


@pytest.mark.base
@pytest.mark.skip
@flaky(max_runs=RERUNS)
def test_download():
# Remove the existing target download directory if it exists
Expand All @@ -124,18 +124,18 @@ def test_download():
assert pm.download, f"could not download {target} distribution"


@pytest.mark.base
@pytest.mark.skip
def test_compile():
assert pm.build() == 0, f"could not compile {target}"


@pytest.mark.regression
@pytest.mark.skip
@pytest.mark.parametrize("cmd", biscayne_cmds)
def test_gridgen(cmd):
assert run_gridgen(cmd), f"could not run {cmd}"


@pytest.mark.base
@pytest.mark.skip
def test_clean_up():
clean_up()

Expand Down
15 changes: 0 additions & 15 deletions autotest/test_gsflow.py → autotest/test_gsflow_run.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import sys

import flopy
import pytest
from flaky import flaky
Expand All @@ -11,8 +9,6 @@

# define program data
target = "gsflow"
if sys.platform.lower() == "win32":
target += ".exe"

# get program dictionary
prog_dict = pymake.usgs_program_data.get_target(target)
Expand Down Expand Up @@ -94,22 +90,11 @@ def run_gsflow(exe, path, example, control_file, normal_message):
return success


@pytest.mark.base
@flaky(max_runs=RERUNS)
def test_gsflow_build(function_tmpdir):
pm.appdir = function_tmpdir
pm.download_target(target, download_path=function_tmpdir)
assert pm.download, f"could not download {target} distribution"
assert pm.build() == 0, f"could not compile {target}"


@pytest.mark.regression
@flaky(max_runs=RERUNS)
def test_gsflow_build_run(function_tmpdir):
pm.appdir = function_tmpdir
pm.download_target(target, download_path=function_tmpdir)
assert pm.download, f"could not download {target} distribution"
assert pm.build() == 0, f"could not compile {target}"
example_path = function_tmpdir / f"{prog_dict.dirname}/data"
assert modify_examples(example_path)
for example, control_file, msg in examples:
Expand Down
8 changes: 4 additions & 4 deletions autotest/test_mf2005.py → autotest/test_mf2005_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def cleanup():
return


@pytest.mark.base
@pytest.mark.skip
def test_download():
# Remove the existing target download directory if it exists
if os.path.isdir(mfpth):
Expand All @@ -127,19 +127,19 @@ def test_download():
assert pm.download, f"could not download {target}"


@pytest.mark.base
@pytest.mark.skip
def test_compile():
assert pm.build() == 0, f"could not compile {target}"


@pytest.mark.regression
@pytest.mark.skip
@pytest.mark.parametrize("fn", name_files)
def test_mf2005(fn):
run_mf2005(fn)
return


@pytest.mark.base
@pytest.mark.skip
def test_cleanup():
cleanup()

Expand Down
Loading

0 comments on commit 7241f50

Please sign in to comment.