Skip to content

Commit 8ec4c64

Browse files
mjrenomjreno
authored andcommitted
add examples head snapshot checks
1 parent 0ee4e7f commit 8ec4c64

File tree

7 files changed

+83
-25
lines changed

7 files changed

+83
-25
lines changed

pixi.lock

Lines changed: 67 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ dependencies = [
4848
"xarray[parallel,io]>=2025.10.1,<2026",
4949
"scipy>=1.16.2,<2",
5050
"sparse>=0.17.0,<0.18",
51+
"syrupy<5",
5152
"dask[array]>=2025.10.0,<2026",
5253
"pyproj>=3.7.2,<4",
5354
"netcdf4>=1.7.3,<2",
928 Bytes
Binary file not shown.
5.4 KB
Binary file not shown.
5.4 KB
Binary file not shown.

test/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from modflow_devtools.download import download_and_unzip
77
from modflow_devtools.misc import is_in_ci
88

9-
pytest_plugins = ["modflow_devtools.fixtures"]
9+
pytest_plugins = ["modflow_devtools.fixtures", "modflow_devtools.snapshots"]
1010

1111
PROJ_ROOT_PATH = Path(__file__).parents[1]
1212
DOCS_PATH = PROJ_ROOT_PATH / "docs"

test/test_examples.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,21 @@ def pytest_generate_tests(metafunc):
1919
metafunc.parametrize("example_script", scripts.values(), ids=scripts.keys())
2020

2121

22+
def check(example_script, snapshot):
23+
from pathlib import Path
24+
25+
from flopy.utils import HeadFile
26+
27+
check_path = Path(f"{example_script.parent}/{example_script.stem}")
28+
for f in check_path.rglob("*.hds"):
29+
hds = HeadFile(f, precision="double")
30+
assert snapshot == hds.get_data()
31+
32+
33+
@pytest.mark.snapshot
2234
@pytest.mark.slow
23-
def test_scripts(example_script):
35+
def test_scripts(example_script, array_snapshot):
2436
args = [sys.executable, example_script]
2537
stdout, stderr, retcode = run_cmd(*args, verbose=True)
2638
assert not retcode, stdout + stderr
39+
check(example_script, array_snapshot)

0 commit comments

Comments
 (0)