Skip to content

Commit 83bff11

Browse files
wpbonelliclaude
andcommitted
fix(tests): invalidate default registry cache in cp alias tests
The test_cli_cp_alias and test_python_cp_alias tests were failing because they sync new registry data but the global _default_registry_cache was not being invalidated. This caused the tests to use a stale cached registry that didn't include the newly synced models. The fix resets _default_registry_cache to None after syncing, forcing get_default_registry() to reload all registries from the cache when the copy functions are called. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 8cb7460 commit 83bff11

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

autotest/test_models.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,10 @@ def test_cli_cp_alias(self, tmp_path):
586586
result = source.sync(ref=TEST_MODELS_REF)
587587
assert len(result.synced) == 1
588588

589+
# Invalidate cached default registry so it reloads with newly synced data
590+
import modflow_devtools.models
591+
modflow_devtools.models._default_registry_cache = None
592+
589593
# Load registry and get first model name
590594
registry = _DEFAULT_CACHE.load(TEST_MODELS_SOURCE_NAME, TEST_MODELS_REF)
591595
assert len(registry.models) > 0
@@ -619,6 +623,10 @@ def test_python_cp_alias(self, tmp_path):
619623
result = source.sync(ref=TEST_MODELS_REF)
620624
assert len(result.synced) == 1
621625

626+
# Invalidate cached default registry so it reloads with newly synced data
627+
import modflow_devtools.models
628+
modflow_devtools.models._default_registry_cache = None
629+
622630
# Load registry and get first model name
623631
registry = _DEFAULT_CACHE.load(TEST_MODELS_SOURCE_NAME, TEST_MODELS_REF)
624632
assert len(registry.models) > 0

0 commit comments

Comments
 (0)