Skip to content

Commit

Permalink
add a dev check in schema ID
Browse files Browse the repository at this point in the history
  • Loading branch information
chrishavlin committed Aug 2, 2023
1 parent e97f811 commit 55f5834
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/yt_napari/_tests/test_schema_version_comparisons.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ def test_version_tupling(string_to_test, expected):
],
)
def test_schema_str_validation(string_to_test, expected):
assert vc.schema_version_is_valid(string_to_test) is expected
assert (
vc.schema_version_is_valid(string_to_test, dev_version_check=False) is expected
)
12 changes: 11 additions & 1 deletion src/yt_napari/schemas/_version_comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
from yt_napari.logging import ytnapari_log


def schema_version_is_valid(schema_version: str) -> bool:
def schema_version_is_valid(
schema_version: str, dev_version_check: bool = True
) -> bool:
pfx = InputModel._schema_prefix
if schema_version is None or pfx not in schema_version:
# the schema does not match a known schema for this plugin
Expand All @@ -25,6 +27,14 @@ def schema_version_is_valid(schema_version: str) -> bool:
)
ytnapari_log.warning(msg)
elif sc_version > version_tuple[:3]:
if dev_version_check and "dev" in version:
msg = (
"You are running a development version of yt-napari, so your "
"specified schema may be valid if it corresponds to an upcoming"
"release."
)
ytnapari_log.info(msg)
return True
# using a new schema with old yt-napari. always fail.
msg = (
f"The version of the supplied schema:\n {schema_version} \n"
Expand Down

0 comments on commit 55f5834

Please sign in to comment.