Move tests from release_mixin to project test folder
This commit is contained in:
parent
f7668231be
commit
408c25028b
14 changed files with 15 additions and 74 deletions
0
src/test/python/release_mixin/__init__.py
Normal file
0
src/test/python/release_mixin/__init__.py
Normal file
|
@ -1,11 +1,11 @@
|
|||
from pathlib import Path
|
||||
from infrastructure_api import SystemAPI
|
||||
from src.main.python.ddadevops.release_mixin.infrastructure_api import SystemAPI
|
||||
|
||||
|
||||
class Helper():
|
||||
def __init__(self, file_name = 'config.json'):
|
||||
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
|
||||
|
||||
def copy_files(self, source: Path, target: Path):
|
|
@ -1,11 +1,4 @@
|
|||
import os
|
||||
import sys
|
||||
|
||||
current = os.path.dirname(os.path.realpath(__file__))
|
||||
parent = os.path.dirname(current)
|
||||
sys.path.append(parent)
|
||||
|
||||
from domain import ReleaseType
|
||||
from src.main.python.ddadevops.release_mixin.domain import ReleaseType
|
||||
|
||||
class MockVersion():
|
||||
|
|
@ -1,13 +1,6 @@
|
|||
import os
|
||||
import sys
|
||||
from mock_domain import MockRelease, MockVersion
|
||||
from mock_infrastructure_api import MockGitApi
|
||||
|
||||
current = os.path.dirname(os.path.realpath(__file__))
|
||||
parent = os.path.dirname(current)
|
||||
sys.path.append(parent)
|
||||
|
||||
from domain import ReleaseType
|
||||
from src.main.python.ddadevops.release_mixin.domain import ReleaseType
|
||||
|
||||
class MockVersionRepository():
|
||||
|
|
@ -1,12 +1,5 @@
|
|||
import sys
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
current = os.path.dirname(os.path.realpath(__file__))
|
||||
parent = os.path.dirname(current)
|
||||
sys.path.append(parent)
|
||||
|
||||
from domain import Version, ReleaseType, Release
|
||||
from src.main.python.ddadevops.release_mixin.domain import Version, ReleaseType, Release
|
||||
|
||||
def test_version(tmp_path: Path):
|
||||
version = Version(tmp_path, [1, 2, 3])
|
|
@ -1,15 +1,7 @@
|
|||
import sys
|
||||
import os
|
||||
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 src.main.python.ddadevops.release_mixin.domain import ReleaseType
|
||||
from src.main.python.ddadevops.release_mixin.infrastructure import ReleaseTypeRepository, VersionRepository, ReleaseRepository
|
||||
from mock_infrastructure_api import MockGitApi
|
||||
|
||||
from helper import Helper
|
||||
|
||||
def test_version_repository(tmp_path):
|
||||
# init
|
|
@ -1,16 +1,10 @@
|
|||
import sys
|
||||
import os
|
||||
import pytest as pt
|
||||
from pathlib import Path
|
||||
from helper import Helper
|
||||
import pytest as pt
|
||||
|
||||
current = os.path.dirname(os.path.realpath(__file__))
|
||||
parent = os.path.dirname(current)
|
||||
sys.path.append(parent)
|
||||
|
||||
from infrastructure_api import GitApi
|
||||
from infrastructure import VersionRepository
|
||||
from domain import ReleaseType
|
||||
from src.main.python.ddadevops.release_mixin.infrastructure_api import GitApi
|
||||
from src.main.python.ddadevops.release_mixin.infrastructure import VersionRepository
|
||||
from src.main.python.ddadevops.release_mixin.domain import ReleaseType
|
||||
|
||||
def change_test_dir( tmp_path: Path, monkeypatch: pt.MonkeyPatch):
|
||||
monkeypatch.chdir(tmp_path)
|
|
@ -1,17 +1,11 @@
|
|||
import sys
|
||||
import os
|
||||
import pytest as pt
|
||||
from helper import Helper
|
||||
from pathlib import Path
|
||||
from ddadevops import *
|
||||
from pybuilder.core import Project
|
||||
|
||||
current = os.path.dirname(os.path.realpath(__file__))
|
||||
parent = os.path.dirname(current)
|
||||
sys.path.append(parent)
|
||||
|
||||
from release_mixin import ReleaseMixin, create_release_mixin_config
|
||||
from infrastructure_api import GitApi
|
||||
from src.main.python.ddadevops.release_mixin.release_mixin import ReleaseMixin, create_release_mixin_config
|
||||
from src.main.python.ddadevops.release_mixin.infrastructure_api import GitApi
|
||||
|
||||
MAIN_BRANCH = 'main'
|
||||
STAGE = 'test'
|
|
@ -1,22 +1,4 @@
|
|||
import sys
|
||||
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 src.main.python.ddadevops.release_mixin.services import PrepareReleaseService, TagAndPushReleaseService
|
||||
from mock_infrastructure import MockReleaseRepository, MockReleaseTypeRepository, MockVersionRepository
|
||||
from mock_infrastructure_api import MockGitApi
|
||||
|
Loading…
Reference in a new issue