From 002864b7438f879db26926d7096ef6bcc5a03446 Mon Sep 17 00:00:00 2001 From: Mirek Simek Date: Mon, 5 Sep 2022 14:22:27 +0200 Subject: [PATCH] fixed saved model location --- oarepo_model_builder/model_preprocessors/default_values.py | 2 +- setup.cfg | 2 +- tests/test_model_saver.py | 7 +++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/oarepo_model_builder/model_preprocessors/default_values.py b/oarepo_model_builder/model_preprocessors/default_values.py index df6d3b86..b9b22101 100644 --- a/oarepo_model_builder/model_preprocessors/default_values.py +++ b/oarepo_model_builder/model_preprocessors/default_values.py @@ -90,4 +90,4 @@ def c(): self.set(settings, "model-name", lambda: settings.package_base) # for outputting the model - self.set(settings, 'saved-model-file', lambda: os.path.join('models', 'model.json')) + self.set(settings, 'saved-model-file', lambda: settings.package_path / 'models' / 'model.json') diff --git a/setup.cfg b/setup.cfg index 6657e2c7..3b7b50c7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = oarepo-model-builder -version = 1.0.0.dev21 +version = 1.0.0.dev22 description = An utility library that generates OARepo required data model files from a JSON specification file authors = Miroslav Bauer , Miroslav Simek readme = README.md diff --git a/tests/test_model_saver.py b/tests/test_model_saver.py index b2bdcc9d..c4fc9442 100644 --- a/tests/test_model_saver.py +++ b/tests/test_model_saver.py @@ -33,7 +33,7 @@ def test_model_saver(): 'package-path': 'test', 'processing-order': ['settings', '*', 'model'], 'python': {'use_black': False, 'use_isort': False}, - 'saved-model-file': 'models/model.json', + 'saved-model-file': 'test/models/model.json', 'schema-file': 'test/records/jsonschemas/test-1.0.0.json', 'schema-name': 'test-1.0.0.json', 'schema-server': 'http://localhost/schemas/', @@ -87,9 +87,8 @@ def build(model, output_builder_components=None, property_preprocessors=None): ), output_dir="", ) - json5.load(builder.filesystem.open(os.path.join("models", "model.json"))) return ( - json5.load(builder.filesystem.open(os.path.join("models", "model.json"))), - builder.filesystem.read(os.path.join("models", "__init__.py")), + json5.load(builder.filesystem.open(os.path.join("test", "models", "model.json"))), + builder.filesystem.read(os.path.join("test", "models", "__init__.py")), builder.filesystem.read("setup.cfg") )