|
|
|
@ -18,11 +18,30 @@ PROJECT_ROOT_PATH = "."
|
|
|
|
|
MODULE = "test"
|
|
|
|
|
BUILD_DIR_NAME = "build_dir"
|
|
|
|
|
|
|
|
|
|
# def change_test_dir( tmp_path: Path, monkeypatch: pt.MonkeyPatch):
|
|
|
|
|
# monkeypatch.chdir(tmp_path)
|
|
|
|
|
|
|
|
|
|
# class MyBuild(ReleaseMixin):
|
|
|
|
|
# pass
|
|
|
|
|
def change_test_dir(tmp_path: Path, monkeypatch: pt.MonkeyPatch):
|
|
|
|
|
monkeypatch.chdir(tmp_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def initialize_with_object(project, CONFIG_FILE):
|
|
|
|
|
project.build_depends_on("ddadevops>=3.1.2")
|
|
|
|
|
build = ReleaseMixin(
|
|
|
|
|
project,
|
|
|
|
|
devops_config(
|
|
|
|
|
{
|
|
|
|
|
"name": "release_test",
|
|
|
|
|
"stage": "test",
|
|
|
|
|
"module": MODULE,
|
|
|
|
|
"project_root_path": PROJECT_ROOT_PATH,
|
|
|
|
|
"build_types": [],
|
|
|
|
|
"mixin_types": ["RELEASE"],
|
|
|
|
|
"build_dir_name": BUILD_DIR_NAME,
|
|
|
|
|
"release_main_branch": MAIN_BRANCH,
|
|
|
|
|
"release_config_file": CONFIG_FILE,
|
|
|
|
|
}
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
return build
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_release_mixin(tmp_path):
|
|
|
|
@ -39,39 +58,31 @@ def test_release_mixin(tmp_path):
|
|
|
|
|
}
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
sut.initialize_build_dir()
|
|
|
|
|
assert os.path.exists(f"{devops_build.build_path()}")
|
|
|
|
|
assert sut is not None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# def initialize_with_object(project, CONFIG_FILE):
|
|
|
|
|
# project.build_depends_on('ddadevops>=3.1.2')
|
|
|
|
|
# devops = Devops(STAGE, PROJECT_ROOT_PATH, MODULE, "release_test", BUILD_DIR_NAME)
|
|
|
|
|
# release = Release(devops, MAIN_BRANCH, CONFIG_FILE)
|
|
|
|
|
# build = MyBuild(project, release)
|
|
|
|
|
# return build
|
|
|
|
|
def test_release_mixin_git(tmp_path: Path, monkeypatch: pt.MonkeyPatch):
|
|
|
|
|
# init
|
|
|
|
|
th = ResourceHelper()
|
|
|
|
|
th.copy_files(th.TEST_FILE_PATH, tmp_path)
|
|
|
|
|
th.TEST_FILE_PATH = tmp_path / th.TEST_FILE_NAME
|
|
|
|
|
|
|
|
|
|
# def test_release_mixin_git(tmp_path: Path, monkeypatch: pt.MonkeyPatch):
|
|
|
|
|
|
|
|
|
|
# # init
|
|
|
|
|
# th = Helper()
|
|
|
|
|
# th.copy_files(th.TEST_FILE_PATH, tmp_path)
|
|
|
|
|
# th.TEST_FILE_PATH = tmp_path / th.TEST_FILE_NAME
|
|
|
|
|
change_test_dir(tmp_path, monkeypatch)
|
|
|
|
|
project = Project(tmp_path)
|
|
|
|
|
|
|
|
|
|
# change_test_dir(tmp_path, monkeypatch)
|
|
|
|
|
# project = Project(tmp_path)
|
|
|
|
|
git_api = GitApi()
|
|
|
|
|
git_api.init()
|
|
|
|
|
git_api.set_user_config("ex.ample@mail.com", "Ex Ample")
|
|
|
|
|
git_api.add_file(th.TEST_FILE_NAME)
|
|
|
|
|
git_api.commit("MAJOR release")
|
|
|
|
|
|
|
|
|
|
# git_api = GitApi()
|
|
|
|
|
# git_api.init()
|
|
|
|
|
# git_api.set_user_config("ex.ample@mail.com", "Ex Ample")
|
|
|
|
|
# git_api.add_file(th.TEST_FILE_NAME)
|
|
|
|
|
# git_api.commit("MAJOR release")
|
|
|
|
|
build = initialize_with_object(project, th.TEST_FILE_PATH)
|
|
|
|
|
build.prepare_release()
|
|
|
|
|
release_version = build.release_repo.version_repository.get_version()
|
|
|
|
|
|
|
|
|
|
# build = initialize_with_object(project, th.TEST_FILE_PATH)
|
|
|
|
|
# build.prepare_release()
|
|
|
|
|
# release_version = build.release_repo.version_repository.get_version()
|
|
|
|
|
# test
|
|
|
|
|
assert "124.0.1-SNAPSHOT" in release_version.get_version_string()
|
|
|
|
|
|
|
|
|
|
# # test
|
|
|
|
|
# assert "124.0.1-SNAPSHOT" in release_version.get_version_string()
|
|
|
|
|
|
|
|
|
|
# def test_release_mixin_environment(tmp_path: Path, monkeypatch: pt.MonkeyPatch):
|
|
|
|
|
|
|
|
|
|