def clean_remote_repo(cls, version: Version = Version(0, 0, 0)): git: GitCmd = GitCmd( state_handler=StateHandler(TestGitFlowHelper.DIR_PATH_TEST)) git.checkout(Branches.MASTER).reset_to_tag(cls.TAG_INIT) \ .push_force() \ .delete_remote_branch_from_name(Branches.DEVELOP.value) \ .delete_tag(str(version), remote=True) \ .delete_tag('-'.join([str(version.next_minor()), Level.DEV.value]), remote=True) Log.info('clean remote repo : ' + str(version))
def setUp(self): self.initial_version: Version = Version(1, 8, 9) self.state_handler: StateHandler = StateHandler(Path('.')) state: State = State() state.version = self.initial_version state.level = Level.STABLE state.schemes = [Schemes.PACKAGE] self.state_handler.state = state
def __input_version(self) -> Init: version: str = input('Develop version ' + Fg.SUCCESS.value + str(Version.DEFAULT_MAJOR) + '.' + str(Version.DEFAULT_MINOR) + '.' + str(Version.DEFAULT_PATCH) + Fg.RESET.value + ' : ') self.state_handler.state.version = Version.from_str( version if version else (str(Version.DEFAULT_MAJOR) + '.' + str(Version.DEFAULT_MINOR) + '.' + str(Version.DEFAULT_PATCH))) return self
def tearDown(self): print('tearDown') TestGitFlowHelper.clean_workdir() TestGitFlowHelper.init_repo(INIT_VERSION) self.git.delete_remote_branch_from_name( 'release/' + INIT_VERSION).delete_remote_branch_from_name( 'release/' + INIT_VERSION + IssueGithub().with_number(ISSUE_NUMBER).get_ref()).delete_tag( INIT_VERSION, remote=True) TestGitFlowHelper.clean_remote_repo(Version.from_str(INIT_VERSION)) TestGitFlowHelper.clean_workdir()
def load_file_config(self) -> StateHandler: if not self.file_path().is_file(): raise FileNotFoundError(self.file_path(), 'Flexio Flow not initialized try : flexio-flow init') f: fileinput = self.file_path().open('r') # TODO: ensure 3.8 compatibility data = yaml.load(f, Loader=yaml.FullLoader) # data = yaml.load(f) f.close() self.__state.version = Version.from_str(data['version']) self.__state.schemes = Schemes.list_from_value(data['schemes']) self.__state.level = Level(data['level']) topics = data.get('topics') if topics is not None and not isinstance(topics, list): topics = [topics] if topics is None: topics = [] self.__state.topics = self.__topics_from_list_number(topics) return self
def fake_state(version: str = '0.0.0') -> State: state: State = State() state.version = Version.from_str(version) state.schemes = [Schemes.PACKAGE] state.level = Level.DEV return state
def fake_state(version: str = '1.5.8') -> State: state: State = State() state.version = Version.from_str(version) state.schemes = [Schemes.PACKAGE] state.level = Level.STABLE return state
def setUp(self): self.version: Version = Version(1, 8, 9)
def tearDown(self): TestGitFlowHelper.clean_remote_repo(Version.from_str(INIT_VERSION)) TestGitFlowHelper.clean_workdir()