Skip to content

Commit

Permalink
define here too
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimergp committed Dec 14, 2024
1 parent 2b76421 commit ad98451
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion menuinst/platforms/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
)

log = getLogger(__name__)
SCHEMA_VERSION = "1-1-0"


class Menu:
Expand Down Expand Up @@ -266,5 +267,5 @@ def platform_key(platform: str = sys.platform) -> str:


menuitem_defaults = json.loads(
(Path(__file__).parents[1] / "data" / "menuinst.default.json").read_text()
(Path(__file__).parents[1] / "data" / f"menuinst-{SCHEMA_VERSION}.default.json").read_text()
)["menu_items"][0]
9 changes: 9 additions & 0 deletions tests/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import json

from menuinst.platforms.base import SCHEMA_VERSION as SCHEMA_VERSION_BASE
from menuinst._schema import SCHEMA_VERSION, dump_default_to_json, dump_schema_to_json
from menuinst.utils import data_path

Expand All @@ -18,3 +19,11 @@ def test_defaults_are_up_to_date():
in_file = json.load(f)
in_code = dump_default_to_json(write=False)
assert in_file == in_code


def test_schema_versions_in_sync():
assert SCHEMA_VERSION_BASE == SCHEMA_VERSION, (
"meninst._schema and menuinst.platforms.base must "
"have the same 'SCHEMA_VERSION' value"
)

0 comments on commit ad98451

Please sign in to comment.