diff --git a/menuinst/platforms/base.py b/menuinst/platforms/base.py index d3119e6b..c7e7926c 100644 --- a/menuinst/platforms/base.py +++ b/menuinst/platforms/base.py @@ -22,6 +22,7 @@ ) log = getLogger(__name__) +SCHEMA_VERSION = "1-1-0" class Menu: @@ -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] diff --git a/tests/test_data.py b/tests/test_data.py index 55628bc4..759f71f9 100644 --- a/tests/test_data.py +++ b/tests/test_data.py @@ -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 @@ -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" + ) + \ No newline at end of file