diff --git a/autotest/test_models.py b/autotest/test_models.py index 3f46ceb..f54b1c7 100644 --- a/autotest/test_models.py +++ b/autotest/test_models.py @@ -430,6 +430,7 @@ def test_registry_to_pooch_format(self, synced_registry): assert len(pooch_registry) == len(synced_registry.files) +@pytest.mark.xdist_group("registry_cache") class TestCLI: """Test CLI commands.""" @@ -453,7 +454,7 @@ def test_cli_list_empty(self, capsys): from modflow_devtools.models.__main__ import cmd_list - args = argparse.Namespace(verbose=False) + args = argparse.Namespace(verbose=False, source=None, ref=None) cmd_list(args) captured = capsys.readouterr() @@ -526,6 +527,11 @@ def test_cli_copy(self, tmp_path): result = source.sync(ref=TEST_MODELS_REF) assert len(result.synced) == 1 + # Invalidate cached default registry so it reloads with newly synced data + import modflow_devtools.models + + modflow_devtools.models._default_registry_cache = None + # Load registry and get first model name registry = _DEFAULT_CACHE.load(TEST_MODELS_SOURCE_NAME, TEST_MODELS_REF) assert len(registry.models) > 0 @@ -558,6 +564,11 @@ def test_cli_copy_nonexistent_model(self, tmp_path, capsys): result = source.sync(ref=TEST_MODELS_REF) assert len(result.synced) == 1 + # Invalidate cached default registry so it reloads with newly synced data + import modflow_devtools.models + + modflow_devtools.models._default_registry_cache = None + # Try to copy nonexistent model import argparse @@ -586,6 +597,11 @@ def test_cli_cp_alias(self, tmp_path): result = source.sync(ref=TEST_MODELS_REF) assert len(result.synced) == 1 + # Invalidate cached default registry so it reloads with newly synced data + import modflow_devtools.models + + modflow_devtools.models._default_registry_cache = None + # Load registry and get first model name registry = _DEFAULT_CACHE.load(TEST_MODELS_SOURCE_NAME, TEST_MODELS_REF) assert len(registry.models) > 0 @@ -619,6 +635,11 @@ def test_python_cp_alias(self, tmp_path): result = source.sync(ref=TEST_MODELS_REF) assert len(result.synced) == 1 + # Invalidate cached default registry so it reloads with newly synced data + import modflow_devtools.models + + modflow_devtools.models._default_registry_cache = None + # Load registry and get first model name registry = _DEFAULT_CACHE.load(TEST_MODELS_SOURCE_NAME, TEST_MODELS_REF) assert len(registry.models) > 0