modflow-devtools 1.5.0__tar.gz → 1.6.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. {modflow_devtools-1.5.0/modflow_devtools.egg-info → modflow_devtools-1.6.0}/PKG-INFO +1 -1
  2. {modflow_devtools-1.5.0 → modflow_devtools-1.6.0}/modflow_devtools/__init__.py +2 -2
  3. {modflow_devtools-1.5.0 → modflow_devtools-1.6.0}/modflow_devtools/misc.py +35 -7
  4. {modflow_devtools-1.5.0 → modflow_devtools-1.6.0}/modflow_devtools/snapshots.py +57 -6
  5. {modflow_devtools-1.5.0 → modflow_devtools-1.6.0/modflow_devtools.egg-info}/PKG-INFO +1 -1
  6. modflow_devtools-1.6.0/version.txt +1 -0
  7. modflow_devtools-1.5.0/version.txt +0 -1
  8. {modflow_devtools-1.5.0 → modflow_devtools-1.6.0}/LICENSE.md +0 -0
  9. {modflow_devtools-1.5.0 → modflow_devtools-1.6.0}/MANIFEST.in +0 -0
  10. {modflow_devtools-1.5.0 → modflow_devtools-1.6.0}/README.md +0 -0
  11. {modflow_devtools-1.5.0 → modflow_devtools-1.6.0}/modflow_devtools/build.py +0 -0
  12. {modflow_devtools-1.5.0 → modflow_devtools-1.6.0}/modflow_devtools/download.py +0 -0
  13. {modflow_devtools-1.5.0 → modflow_devtools-1.6.0}/modflow_devtools/fixtures.py +0 -0
  14. {modflow_devtools-1.5.0 → modflow_devtools-1.6.0}/modflow_devtools/imports.py +0 -0
  15. {modflow_devtools-1.5.0 → modflow_devtools-1.6.0}/modflow_devtools/latex.py +0 -0
  16. {modflow_devtools-1.5.0 → modflow_devtools-1.6.0}/modflow_devtools/markers.py +0 -0
  17. {modflow_devtools-1.5.0 → modflow_devtools-1.6.0}/modflow_devtools/ostags.py +0 -0
  18. {modflow_devtools-1.5.0 → modflow_devtools-1.6.0}/modflow_devtools/zip.py +0 -0
  19. {modflow_devtools-1.5.0 → modflow_devtools-1.6.0}/modflow_devtools.egg-info/SOURCES.txt +0 -0
  20. {modflow_devtools-1.5.0 → modflow_devtools-1.6.0}/modflow_devtools.egg-info/dependency_links.txt +0 -0
  21. {modflow_devtools-1.5.0 → modflow_devtools-1.6.0}/modflow_devtools.egg-info/not-zip-safe +0 -0
  22. {modflow_devtools-1.5.0 → modflow_devtools-1.6.0}/modflow_devtools.egg-info/requires.txt +0 -0
  23. {modflow_devtools-1.5.0 → modflow_devtools-1.6.0}/modflow_devtools.egg-info/top_level.txt +0 -0
  24. {modflow_devtools-1.5.0 → modflow_devtools-1.6.0}/pyproject.toml +0 -0
  25. {modflow_devtools-1.5.0 → modflow_devtools-1.6.0}/setup.cfg +0 -0
  26. {modflow_devtools-1.5.0 → modflow_devtools-1.6.0}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: modflow-devtools
3
- Version: 1.5.0
3
+ Version: 1.6.0
4
4
  Summary: Python tools for MODFLOW development
5
5
  Author-email: "Joseph D. Hughes" <modflow@usgs.gov>, Michael Reno <mreno@ucar.edu>, Mike Taves <mwtoews@gmail.com>, Wes Bonelli <wbonelli@ucar.edu>
6
6
  Maintainer-email: "Joseph D. Hughes" <modflow@usgs.gov>
@@ -1,6 +1,6 @@
1
1
  __author__ = "Joseph D. Hughes"
2
- __date__ = "May 15, 2024"
3
- __version__ = "1.5.0"
2
+ __date__ = "May 30, 2024"
3
+ __version__ = "1.6.0"
4
4
  __maintainer__ = "Joseph D. Hughes"
5
5
  __email__ = "jdhughes@usgs.gov"
6
6
  __status__ = "Production"
@@ -284,13 +284,41 @@ def get_model_paths(
284
284
  Find model directories recursively in the given location.
285
285
  A model directory is any directory containing one or more
286
286
  namefiles. Model directories can be filtered or excluded,
287
- by prefix, pattern, namefile name, or packages used.
288
- """
289
-
290
- namefile_paths = get_namefile_paths(
291
- path, prefix, namefile, excluded, selected, packages
292
- )
293
- model_paths = sorted(list(set([p.parent for p in namefile_paths if p.parent.name])))
287
+ by prefix, pattern, namefile name, or packages used. The
288
+ directories are returned in order within scenario folders
289
+ such that groundwater flow model workspaces precede other
290
+ model types. This allows models which depend on the flow
291
+ model's outputs to consume its head or budget, and models
292
+ should successfully run in the sequence returned provided
293
+ input files (e.g. FMI) refer to output via relative paths.
294
+ """
295
+
296
+ def keyfunc(v):
297
+ v = str(v)
298
+ if "gwf" in v:
299
+ return 0
300
+ else:
301
+ return 1
302
+
303
+ model_paths = []
304
+ globbed = path.rglob(f"{prefix if prefix else ''}*")
305
+ example_paths = [p for p in globbed if p.is_dir()]
306
+ for p in example_paths:
307
+ for mp in sorted(
308
+ list(
309
+ set(
310
+ [
311
+ p.parent
312
+ for p in get_namefile_paths(
313
+ p, prefix, namefile, excluded, selected, packages
314
+ )
315
+ ]
316
+ )
317
+ ),
318
+ key=keyfunc,
319
+ ):
320
+ if mp not in model_paths:
321
+ model_paths.append(mp)
294
322
  return model_paths
295
323
 
296
324
 
@@ -8,10 +8,13 @@ pytest = import_optional_dependency("pytest")
8
8
  syrupy = import_optional_dependency("syrupy")
9
9
 
10
10
  # ruff: noqa: E402
11
+ from syrupy import __import_extension
12
+ from syrupy.assertion import SnapshotAssertion
11
13
  from syrupy.extensions.single_file import (
12
14
  SingleFileSnapshotExtension,
13
15
  WriteMode,
14
16
  )
17
+ from syrupy.location import PyTestLocation
15
18
  from syrupy.types import (
16
19
  PropertyFilter,
17
20
  PropertyMatcher,
@@ -90,19 +93,67 @@ class ReadableArrayExtension(SingleFileSnapshotExtension):
90
93
  return np.array2string(data, threshold=np.inf)
91
94
 
92
95
 
96
+ class MatchAnything:
97
+ def __eq__(self, _):
98
+ return True
99
+
100
+
93
101
  # fixtures
94
102
 
95
103
 
104
+ @pytest.fixture(scope="session")
105
+ def snapshot_disable(pytestconfig) -> bool:
106
+ return pytestconfig.getoption("--snapshot-disable")
107
+
108
+
96
109
  @pytest.fixture
97
- def array_snapshot(snapshot):
98
- return snapshot.use_extension(BinaryArrayExtension)
110
+ def snapshot(request, snapshot_disable) -> "SnapshotAssertion":
111
+ return (
112
+ MatchAnything()
113
+ if snapshot_disable
114
+ else SnapshotAssertion(
115
+ update_snapshots=request.config.option.update_snapshots,
116
+ extension_class=__import_extension(request.config.option.default_extension),
117
+ test_location=PyTestLocation(request.node),
118
+ session=request.session.config._syrupy,
119
+ )
120
+ )
99
121
 
100
122
 
101
123
  @pytest.fixture
102
- def text_array_snapshot(snapshot):
103
- return snapshot.use_extension(TextArrayExtension)
124
+ def array_snapshot(snapshot, snapshot_disable):
125
+ return (
126
+ MatchAnything()
127
+ if snapshot_disable
128
+ else snapshot.use_extension(BinaryArrayExtension)
129
+ )
104
130
 
105
131
 
106
132
  @pytest.fixture
107
- def readable_array_snapshot(snapshot):
108
- return snapshot.use_extension(ReadableArrayExtension)
133
+ def text_array_snapshot(snapshot, snapshot_disable):
134
+ return (
135
+ MatchAnything()
136
+ if snapshot_disable
137
+ else snapshot.use_extension(TextArrayExtension)
138
+ )
139
+
140
+
141
+ @pytest.fixture
142
+ def readable_array_snapshot(snapshot, snapshot_disable):
143
+ return (
144
+ MatchAnything()
145
+ if snapshot_disable
146
+ else snapshot.use_extension(ReadableArrayExtension)
147
+ )
148
+
149
+
150
+ # pytest config hooks
151
+
152
+
153
+ def pytest_addoption(parser):
154
+ parser.addoption(
155
+ "--snapshot-disable",
156
+ action="store_true",
157
+ default=False,
158
+ help="Disable snapshot comparisons.",
159
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: modflow-devtools
3
- Version: 1.5.0
3
+ Version: 1.6.0
4
4
  Summary: Python tools for MODFLOW development
5
5
  Author-email: "Joseph D. Hughes" <modflow@usgs.gov>, Michael Reno <mreno@ucar.edu>, Mike Taves <mwtoews@gmail.com>, Wes Bonelli <wbonelli@ucar.edu>
6
6
  Maintainer-email: "Joseph D. Hughes" <modflow@usgs.gov>
@@ -0,0 +1 @@
1
+ 1.6.0
@@ -1 +0,0 @@
1
- 1.5.0