Move tests from release_mixin to project test folder

merge-requests/6/merge
bom 1 year ago
parent f7668231be
commit 408c25028b

@ -1,11 +1,11 @@
from pathlib import Path from pathlib import Path
from infrastructure_api import SystemAPI from src.main.python.ddadevops.release_mixin.infrastructure_api import SystemAPI
class Helper(): class Helper():
def __init__(self, file_name = 'config.json'): def __init__(self, file_name = 'config.json'):
self.TEST_FILE_NAME = file_name self.TEST_FILE_NAME = file_name
self.TEST_FILE_ROOT = Path('test/resources/') self.TEST_FILE_ROOT = Path('src/test/resources/')
self.TEST_FILE_PATH = self.TEST_FILE_ROOT / self.TEST_FILE_NAME self.TEST_FILE_PATH = self.TEST_FILE_ROOT / self.TEST_FILE_NAME
def copy_files(self, source: Path, target: Path): def copy_files(self, source: Path, target: Path):

@ -1,11 +1,4 @@
import os from src.main.python.ddadevops.release_mixin.domain import ReleaseType
import sys
current = os.path.dirname(os.path.realpath(__file__))
parent = os.path.dirname(current)
sys.path.append(parent)
from domain import ReleaseType
class MockVersion(): class MockVersion():

@ -1,13 +1,6 @@
import os
import sys
from mock_domain import MockRelease, MockVersion from mock_domain import MockRelease, MockVersion
from mock_infrastructure_api import MockGitApi from mock_infrastructure_api import MockGitApi
from src.main.python.ddadevops.release_mixin.domain import ReleaseType
current = os.path.dirname(os.path.realpath(__file__))
parent = os.path.dirname(current)
sys.path.append(parent)
from domain import ReleaseType
class MockVersionRepository(): class MockVersionRepository():

@ -1,12 +1,5 @@
import sys
import os
from pathlib import Path from pathlib import Path
from src.main.python.ddadevops.release_mixin.domain import Version, ReleaseType, Release
current = os.path.dirname(os.path.realpath(__file__))
parent = os.path.dirname(current)
sys.path.append(parent)
from domain import Version, ReleaseType, Release
def test_version(tmp_path: Path): def test_version(tmp_path: Path):
version = Version(tmp_path, [1, 2, 3]) version = Version(tmp_path, [1, 2, 3])

@ -1,15 +1,7 @@
import sys from src.main.python.ddadevops.release_mixin.domain import ReleaseType
import os from src.main.python.ddadevops.release_mixin.infrastructure import ReleaseTypeRepository, VersionRepository, ReleaseRepository
from helper import Helper
current = os.path.dirname(os.path.realpath(__file__))
parent = os.path.dirname(current)
sys.path.append(parent)
from domain import ReleaseType
from infrastructure import ReleaseTypeRepository, VersionRepository, ReleaseRepository
from mock_infrastructure_api import MockGitApi from mock_infrastructure_api import MockGitApi
from helper import Helper
def test_version_repository(tmp_path): def test_version_repository(tmp_path):
# init # init

@ -1,16 +1,10 @@
import sys
import os
import pytest as pt
from pathlib import Path from pathlib import Path
from helper import Helper from helper import Helper
import pytest as pt
current = os.path.dirname(os.path.realpath(__file__)) from src.main.python.ddadevops.release_mixin.infrastructure_api import GitApi
parent = os.path.dirname(current) from src.main.python.ddadevops.release_mixin.infrastructure import VersionRepository
sys.path.append(parent) from src.main.python.ddadevops.release_mixin.domain import ReleaseType
from infrastructure_api import GitApi
from infrastructure import VersionRepository
from domain import ReleaseType
def change_test_dir( tmp_path: Path, monkeypatch: pt.MonkeyPatch): def change_test_dir( tmp_path: Path, monkeypatch: pt.MonkeyPatch):
monkeypatch.chdir(tmp_path) monkeypatch.chdir(tmp_path)

@ -1,17 +1,11 @@
import sys
import os
import pytest as pt import pytest as pt
from helper import Helper from helper import Helper
from pathlib import Path from pathlib import Path
from ddadevops import * from ddadevops import *
from pybuilder.core import Project from pybuilder.core import Project
current = os.path.dirname(os.path.realpath(__file__)) from src.main.python.ddadevops.release_mixin.release_mixin import ReleaseMixin, create_release_mixin_config
parent = os.path.dirname(current) from src.main.python.ddadevops.release_mixin.infrastructure_api import GitApi
sys.path.append(parent)
from release_mixin import ReleaseMixin, create_release_mixin_config
from infrastructure_api import GitApi
MAIN_BRANCH = 'main' MAIN_BRANCH = 'main'
STAGE = 'test' STAGE = 'test'

@ -1,22 +1,4 @@
import sys from src.main.python.ddadevops.release_mixin.services import PrepareReleaseService, TagAndPushReleaseService
import os
# getting the name of the directory
# where the this file is present.
current = os.path.dirname(os.path.realpath(__file__))
# Getting the parent directory name
# where the current directory is present.
parent = os.path.dirname(current)
# adding the parent directory to
# the sys.path.
sys.path.append(parent)
# now we can import the module in the parent
# directory.
from services import PrepareReleaseService, TagAndPushReleaseService
from mock_infrastructure import MockReleaseRepository, MockReleaseTypeRepository, MockVersionRepository from mock_infrastructure import MockReleaseRepository, MockReleaseTypeRepository, MockVersionRepository
from mock_infrastructure_api import MockGitApi from mock_infrastructure_api import MockGitApi
Loading…
Cancel
Save