def setUp(self): self.tmp_dir = tempfile.TemporaryDirectory() self.render_step = step_def('update_component_deps') self.update_component_deps_trait = update_component_deps.UpdateComponentDependenciesTrait( name='update_component_dependencies', variant_name='don\'t_care', raw_dict={ 'set_dependency_version_script': 'some_path', 'upstream_component_name': 'don\'t_care', }, ) self.main_repo = test_utils.repository() repo_dir = pathlib.Path(self.tmp_dir.name, self.main_repo.resource_name()) repo_dir.mkdir() self.job_variant = test_utils.job(self.main_repo) self.job_variant._traits_dict = { 'update_component_deps': self.update_component_deps_trait } self.old_cwd = os.getcwd()
def setUp(self): self.tmp_dir = tempfile.TemporaryDirectory() self.component_descriptor_trait = component_descriptor.ComponentDescriptorTrait( name='component_descriptor', variant_name='don\'t_care', raw_dict={ 'component_name': 'github.com/org/repo_name', }, ) self.component_descriptor_transformer = self.component_descriptor_trait.transformer() self.render_step = step_def('component_descriptor') self.main_repo = test_utils.repository() repo_dir = pathlib.Path(self.tmp_dir.name, self.main_repo.resource_name()) repo_dir.mkdir() self.job_variant = test_utils.job(self.main_repo) self.job_variant._traits_dict = {'component_descriptor': self.component_descriptor_trait} for step in self.component_descriptor_transformer.inject_steps(): self.job_variant._steps_dict[step.name] = step self.component_descriptor_step = self.job_variant.step('component_descriptor') self.component_descriptor_step.add_input('version_path', 'version_path') self.old_cwd = os.getcwd()
def setUp(self): self.tmp_dir = tempfile.TemporaryDirectory() self.version_outdir = pathlib.Path(self.tmp_dir.name, 'managed-version') self.version_outdir.mkdir() self.version_trait = version_trait.VersionTrait( name='version', variant_name='don\'t_care', raw_dict={ 'versionfile': 'version', 'preprocess': 'finalize', }, ) self.version_trait_transformer = self.version_trait.transformer() self.render_step = step_def('version') self.main_repo = test_utils.repository() repo_dir = pathlib.Path(self.tmp_dir.name, self.main_repo.resource_name()) repo_dir.mkdir() # create fake git dir os.mkdir(repo_dir.joinpath('.git')) repo_dir.joinpath('.git', 'HEAD').touch() self.version_file = repo_dir.joinpath('version') self.version_file.write_text('1.2.3-xxx') self.job_variant = test_utils.job(self.main_repo) self.job_variant._traits_dict = {'version': self.version_trait} for step in self.version_trait_transformer.inject_steps(): self.job_variant._steps_dict[step.name] = step self.old_cwd = os.getcwd()
def setUp(self): self.tmp_dir = tempfile.TemporaryDirectory() self.render_step = step_def('update_component_deps') self.update_component_deps_trait = update_component_deps.UpdateComponentDependenciesTrait( name='update_component_dependencies', variant_name='don\'t_care', raw_dict={ 'set_dependency_version_script':'some_path', 'upstream_component_name':'don\'t_care', }, ) self.component_descriptor_trait = component_descriptor.ComponentDescriptorTrait( name='component_descriptor', variant_name='don\'t_care', raw_dict={ 'component_name': 'github.com/org/repo_name', }, ) self.component_descriptor_trait.ctx_repository = lambda: cm.OciRepositoryContext( baseUrl='dummy-base-url', ) self.main_repo = test_utils.repository() repo_dir = pathlib.Path(self.tmp_dir.name, self.main_repo.resource_name()) repo_dir.mkdir() self.job_variant = test_utils.job(self.main_repo) self.job_variant._traits_dict = { 'update_component_deps': self.update_component_deps_trait, 'component_descriptor': self.component_descriptor_trait, } self.old_cwd = os.getcwd()