Enable release mixin test
This commit is contained in:
parent
4098d00409
commit
5d2bbb758c
1 changed files with 27 additions and 27 deletions
|
@ -1,15 +1,17 @@
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import pytest as pt
|
import pytest as pt
|
||||||
|
from helper import Helper
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from ddadevops import *
|
from ddadevops import *
|
||||||
|
from pybuilder.core import Project
|
||||||
|
|
||||||
current = os.path.dirname(os.path.realpath(__file__))
|
current = os.path.dirname(os.path.realpath(__file__))
|
||||||
parent = os.path.dirname(current)
|
parent = os.path.dirname(current)
|
||||||
sys.path.append(parent)
|
sys.path.append(parent)
|
||||||
|
|
||||||
from pybuilder.core import task, init, Project
|
|
||||||
from release_mixin import ReleaseMixin, create_release_mixin_config
|
from release_mixin import ReleaseMixin, create_release_mixin_config
|
||||||
|
from infrastructure_api import GitApi
|
||||||
|
|
||||||
MAIN_BRANCH = 'main'
|
MAIN_BRANCH = 'main'
|
||||||
STAGE = 'test'
|
STAGE = 'test'
|
||||||
|
@ -17,6 +19,9 @@ PROJECT_ROOT_PATH = '.'
|
||||||
MODULE = 'test'
|
MODULE = 'test'
|
||||||
BUILD_DIR_NAME = "build_dir"
|
BUILD_DIR_NAME = "build_dir"
|
||||||
|
|
||||||
|
def change_test_dir( tmp_path: Path, monkeypatch: pt.MonkeyPatch):
|
||||||
|
monkeypatch.chdir(tmp_path)
|
||||||
|
|
||||||
class MyBuild(ReleaseMixin):
|
class MyBuild(ReleaseMixin):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -30,29 +35,24 @@ def initialize(project, CONFIG_FILE):
|
||||||
build = MyBuild(project, config)
|
build = MyBuild(project, config)
|
||||||
return build
|
return build
|
||||||
|
|
||||||
#def test_release_mixin(tmp_path):
|
def test_release_mixin(tmp_path: Path, monkeypatch: pt.MonkeyPatch):
|
||||||
#
|
|
||||||
# #init
|
# init
|
||||||
# with open(f'test/resources/config.json', 'r') as json_file:
|
th = Helper()
|
||||||
# contents = json_file.read()
|
th.copy_files(th.TEST_FILE_PATH, tmp_path)
|
||||||
#
|
th.TEST_FILE_PATH = tmp_path / th.TEST_FILE_NAME
|
||||||
# CONFIG_FILE = tmp_path / "config.json"
|
|
||||||
# CONFIG_FILE.write_text(contents)
|
change_test_dir(tmp_path, monkeypatch)
|
||||||
#
|
project = Project(tmp_path)
|
||||||
# base_dir = "."
|
|
||||||
# project = Project(base_dir)
|
git_api = GitApi()
|
||||||
#
|
git_api.init()
|
||||||
# # init
|
git_api.add_file(th.TEST_FILE_NAME)
|
||||||
# build = initialize(project, CONFIG_FILE)
|
git_api.commit("MAJOR release")
|
||||||
# build.commit_string = "MAJOR bla"
|
|
||||||
# build.init_release()
|
build = initialize(project, th.TEST_FILE_PATH)
|
||||||
# release_version = build.release_version
|
build.prepare_release()
|
||||||
#
|
release_version = build.version_repo.get_version()
|
||||||
# # test
|
|
||||||
# assert "124.0.0" in release_version.get_version_string()
|
# test
|
||||||
#
|
assert "124.0.1-SNAPSHOT" in release_version.get_version_string()
|
||||||
# # init
|
|
||||||
# bump_version = build.bump_version
|
|
||||||
#
|
|
||||||
# # test
|
|
||||||
# assert "124.0.1-SNAPSHOT" in bump_version.get_version_string()
|
|
||||||
|
|
Loading…
Reference in a new issue