From d759036989ea180aac4572bfc6a64b2e85bfb255 Mon Sep 17 00:00:00 2001 From: erik Date: Wed, 22 Feb 2023 16:19:36 +0100 Subject: [PATCH] Create realistic test conditions --- test/test_release_mixin.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/test/test_release_mixin.py b/test/test_release_mixin.py index 601f3fd..e83ad85 100644 --- a/test/test_release_mixin.py +++ b/test/test_release_mixin.py @@ -23,7 +23,10 @@ from version import * from release_mixin import ReleaseMixin, create_release_mixin_config MAIN_BRANCH = 'main' - +STAGE = 'test' +PROJECT_ROOT_PATH = '.' +MODULE = 'test' +BUILD_DIR_NAME = "build_dir" class MyBuild(ReleaseMixin): pass @@ -31,11 +34,16 @@ class MyBuild(ReleaseMixin): def initialize(project, CONFIG_FILE): project.build_depends_on('ddadevops>=3.1.2') config = create_release_mixin_config(CONFIG_FILE, MAIN_BRANCH) + config.update({'stage': STAGE}) + config.update({'module': MODULE}) + config.update({'project_root_path': PROJECT_ROOT_PATH}) + config.update({'build_dir_name': BUILD_DIR_NAME}) build = MyBuild(project, config) return build def test_release_mixin(tmp_path): + #init with open(f'test/resources/config.json', 'r') as json_file: contents = json_file.read() @@ -46,11 +54,16 @@ def test_release_mixin(tmp_path): project = Project(base_dir) # init - build = initialize(project, CONFIG_FILE) + build = initialize(project, CONFIG_FILE) + build.commit_string = "MAJOR bla" build.init() release_version = build.release_version + + # test + assert "124.0.0" in release_version.get_version_string() + + # init bump_version = build.bump_version # test - assert "123.124.0" in release_version.get_version_string() - assert "123.124.1-SNAPSHOT" in bump_version.get_version_string() \ No newline at end of file + assert "124.0.1-SNAPSHOT" in bump_version.get_version_string() \ No newline at end of file