diff --git a/.github/workflows/commit.yml b/.github/workflows/commit.yml index 85751cf635..cbf1e3e5e9 100644 --- a/.github/workflows/commit.yml +++ b/.github/workflows/commit.yml @@ -4,7 +4,6 @@ on: branches: - master - develop - - release* - ci-diagnose* pull_request: branches: diff --git a/autotest/generate_classes.py b/autotest/generate_classes.py deleted file mode 100644 index eb46c97097..0000000000 --- a/autotest/generate_classes.py +++ /dev/null @@ -1,29 +0,0 @@ -import os - -import pytest -from autotest.conftest import get_project_root_path -from modflow_devtools.markers import excludes_branch - -from flopy.mf6.utils import generate_classes - -_project_root_path = get_project_root_path() -_using_xdist = bool(os.environ.get("PYTEST_XDIST_WORKER", None)) - - -@excludes_branch("master") -@pytest.mark.mf6 -@pytest.mark.skipif( - _using_xdist, - reason="modifies and reverts repository files, can't be run in parallel", -) -def test_generate_classes_from_dfn(): - try: - generate_classes(branch="develop", backup=False) - finally: - paths = [ - _project_root_path / "flopy" / "mf6" / "data" / "dfn", - _project_root_path / "flopy" / "mf6" / "modflow", - ] - # restoring might lose work if these files have been modified - for path in paths: - os.system(f"git restore {path}") diff --git a/autotest/test_binaryfile.py b/autotest/test_binaryfile.py index 47c59603d6..68c305e7ad 100644 --- a/autotest/test_binaryfile.py +++ b/autotest/test_binaryfile.py @@ -1,3 +1,5 @@ +from pprint import pprint + import numpy as np import pytest from autotest.conftest import get_example_data_path @@ -13,7 +15,12 @@ HeadUFile, Util2d, ) -from flopy.utils.binaryfile import get_headfile_precision +from flopy.utils.binaryfile import ( + get_headfile_precision, + write_budget, + write_head, +) +from flopy.utils.gridutil import uniform_flow_field @pytest.fixture @@ -241,11 +248,38 @@ def test_budgetfile_detect_precision_double(path): assert file.realtype == np.float64 -@pytest.mark.skip(reason="todo") -def test_write_head(): - pass +def test_write_head(function_tmpdir): + file_path = function_tmpdir / "headfile" + head_data = np.random.random((10, 10)) + + write_head(file_path, head_data) + + assert file_path.is_file() + content = np.fromfile(file_path) + assert np.array_equal(head_data.ravel(), content) + + # TODO: what else needs to be checked here? + + +def test_write_budget(function_tmpdir): + file_path = function_tmpdir / "budgetfile" + + nlay = 3 + nrow = 3 + ncol = 3 + qx = 1.0 + qy = 0.0 + qz = 0.0 + shape = (nlay, nrow, ncol) + spdis, flowja = uniform_flow_field(qx, qy, qz, shape) + + write_budget(file_path, flowja, kstp=0) + assert file_path.is_file() + content1 = np.fromfile(file_path) + write_budget(file_path, flowja, kstp=1, kper=1, text="text") + assert file_path.is_file() + content2 = np.fromfile(file_path) -@pytest.mark.skip(reason="todo") -def test_write_budget(): - pass + # TODO: why are these the same? + assert np.array_equal(content1, content2)