Skip to content

Commit be5d405

Browse files
committed
fixes
1 parent f50e43f commit be5d405

4 files changed

Lines changed: 23 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ jobs:
102102
cache-dependency-glob: "**/pyproject.toml"
103103
python-version: ${{ matrix.python }}
104104

105+
- name: Setup Fortran
106+
uses: fortran-lang/setup-fortran@v1
107+
105108
- name: Install project
106109
working-directory: modflow-devtools
107110
run: uv sync --all-extras

autotest/test_dfns_registry.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from unittest.mock import patch
1212

1313
import pytest
14+
from flaky import flaky
1415
from packaging.version import Version
1516

1617
from modflow_devtools.dfns.fetch import fetch_dfns
@@ -634,6 +635,7 @@ def test_construct_raw_url_with_repo_override(self):
634635
assert TEST_DFN_REPO in url
635636
assert TEST_DFN_REF in url
636637

638+
@flaky(max_runs=3, min_passes=1)
637639
def test_fetch_registry(self):
638640
"""Test fetching registry from the test repository."""
639641
from modflow_devtools.dfns.registry import RemoteDfnRegistry
@@ -652,6 +654,7 @@ def test_fetch_registry(self):
652654
# (e.g., generated from develop branch but accessed on registry branch)
653655
assert meta.ref is not None
654656

657+
@flaky(max_runs=3, min_passes=1)
655658
def test_sync_files(self):
656659
"""Test syncing DFN files from the test repository."""
657660
from modflow_devtools.dfns.registry import RemoteDfnRegistry
@@ -669,6 +672,7 @@ def test_sync_files(self):
669672
path = registry.get_dfn_path("gwf-chd")
670673
assert path.exists()
671674

675+
@flaky(max_runs=3, min_passes=1)
672676
def test_get_dfn(self):
673677
"""Test getting a DFN from the test repository."""
674678
from modflow_devtools.dfns import Dfn
@@ -688,6 +692,7 @@ def test_get_dfn(self):
688692
assert isinstance(dfn, Dfn)
689693
assert dfn.name == "gwf-chd"
690694

695+
@flaky(max_runs=3, min_passes=1)
691696
def test_get_spec(self):
692697
"""Test getting the full spec from the test repository."""
693698
from modflow_devtools.dfns import DfnSpec
@@ -708,6 +713,7 @@ def test_get_spec(self):
708713
assert "gwf-chd" in spec
709714
assert "sim-nam" in spec
710715

716+
@flaky(max_runs=3, min_passes=1)
711717
def test_list_components(self):
712718
"""Test listing available components from the test repository."""
713719
from modflow_devtools.dfns.registry import RemoteDfnRegistry

autotest/test_models.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from pathlib import Path
1111

1212
import pytest
13+
from flaky import flaky
1314

1415
from modflow_devtools.models import (
1516
_DEFAULT_CACHE,
@@ -231,6 +232,7 @@ def test_get_registry_cache_dir(self):
231232
class TestDiscovery:
232233
"""Test registry discovery."""
233234

235+
@flaky(max_runs=3, min_passes=1)
234236
def test_discover_registry(self):
235237
"""Test discovering registry for test repo."""
236238
# Use test repo/ref from environment
@@ -248,6 +250,7 @@ def test_discover_registry(self):
248250
assert discovered.mode == "version_controlled"
249251
assert isinstance(discovered.registry, ModelRegistry)
250252

253+
@flaky(max_runs=3, min_passes=1)
251254
def test_discover_registry_nonexistent_ref(self):
252255
"""Test that discovery fails gracefully for nonexistent ref."""
253256
source = ModelSourceRepo(
@@ -264,6 +267,7 @@ def test_discover_registry_nonexistent_ref(self):
264267
class TestSync:
265268
"""Test registry synchronization."""
266269

270+
@flaky(max_runs=3, min_passes=1)
267271
def test_sync_single_source_single_ref(self):
268272
"""Test syncing a single source/ref."""
269273
_DEFAULT_CACHE.clear(source=TEST_MODELS_SOURCE_NAME, ref=TEST_MODELS_REF)
@@ -280,6 +284,7 @@ def test_sync_single_source_single_ref(self):
280284
assert len(result.failed) == 0
281285
assert (TEST_MODELS_SOURCE_NAME, TEST_MODELS_REF) in result.synced
282286

287+
@flaky(max_runs=3, min_passes=1)
283288
def test_sync_creates_cache(self):
284289
"""Test that sync creates cached registry."""
285290
_DEFAULT_CACHE.clear(source=TEST_MODELS_SOURCE_NAME, ref=TEST_MODELS_REF)
@@ -293,6 +298,7 @@ def test_sync_creates_cache(self):
293298
source.sync(ref=TEST_MODELS_REF)
294299
assert _DEFAULT_CACHE.has(TEST_MODELS_SOURCE_NAME, TEST_MODELS_REF)
295300

301+
@flaky(max_runs=3, min_passes=1)
296302
def test_sync_skip_cached(self):
297303
"""Test that sync skips already-cached registries."""
298304
_DEFAULT_CACHE.clear(source=TEST_MODELS_SOURCE_NAME, ref=TEST_MODELS_REF)
@@ -312,6 +318,7 @@ def test_sync_skip_cached(self):
312318
assert len(result2.synced) == 0
313319
assert len(result2.skipped) == 1
314320

321+
@flaky(max_runs=3, min_passes=1)
315322
def test_sync_force(self):
316323
"""Test that force flag re-syncs cached registries."""
317324
_DEFAULT_CACHE.clear(source=TEST_MODELS_SOURCE_NAME, ref=TEST_MODELS_REF)
@@ -331,6 +338,7 @@ def test_sync_force(self):
331338
assert len(result.synced) == 1
332339
assert len(result.skipped) == 0
333340

341+
@flaky(max_runs=3, min_passes=1)
334342
def test_sync_via_source_method(self):
335343
"""Test syncing via ModelSourceRepo.sync() method."""
336344
_DEFAULT_CACHE.clear(source=TEST_MODELS_SOURCE_NAME, ref=TEST_MODELS_REF)
@@ -348,6 +356,7 @@ def test_sync_via_source_method(self):
348356
assert len(result.synced) == 1
349357
assert (TEST_MODELS_SOURCE_NAME, TEST_MODELS_REF) in result.synced
350358

359+
@flaky(max_runs=3, min_passes=1)
351360
def test_source_is_synced_method(self):
352361
"""Test ModelSourceRepo.is_synced() method."""
353362
_DEFAULT_CACHE.clear(source=TEST_MODELS_SOURCE_NAME, ref=TEST_MODELS_REF)
@@ -362,6 +371,7 @@ def test_source_is_synced_method(self):
362371
source.sync(ref=TEST_MODELS_REF)
363372
assert source.is_synced(TEST_MODELS_REF)
364373

374+
@flaky(max_runs=3, min_passes=1)
365375
def test_source_list_synced_refs_method(self):
366376
"""Test ModelSourceRepo.list_synced_refs() method."""
367377
_DEFAULT_CACHE.clear(source=TEST_MODELS_SOURCE_NAME, ref=TEST_MODELS_REF)
@@ -509,6 +519,7 @@ def test_cli_clear(self, capsys):
509519
class TestIntegration:
510520
"""Integration tests for full workflows."""
511521

522+
@flaky(max_runs=3, min_passes=1)
512523
def test_full_workflow(self):
513524
"""Test complete workflow: discover -> cache -> load."""
514525
_DEFAULT_CACHE.clear(source=TEST_MODELS_SOURCE_NAME, ref=TEST_MODELS_REF)
@@ -531,6 +542,7 @@ def test_full_workflow(self):
531542
assert loaded is not None
532543
assert len(loaded.models) == len(discovered.registry.models)
533544

545+
@flaky(max_runs=3, min_passes=1)
534546
def test_sync_and_list_models(self):
535547
"""Test syncing and listing available models."""
536548
_DEFAULT_CACHE.clear(source=TEST_MODELS_SOURCE_NAME, ref=TEST_MODELS_REF)

autotest/test_programs.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from pathlib import Path
33

44
import pytest
5+
from flaky import flaky
56

67
from modflow_devtools.programs import (
78
_DEFAULT_CACHE,
@@ -493,6 +494,7 @@ def test_nonexistent_platform_uses_fallback(self):
493494
class TestForceSemantics:
494495
"""Test force flag semantics for sync and install."""
495496

497+
@flaky(max_runs=3, min_passes=1)
496498
def test_sync_force_flag(self):
497499
"""Test that sync --force re-downloads even if cached."""
498500
# Clear cache first

0 commit comments

Comments
 (0)