Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion autotest/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""

Expand All @@ -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()
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down