def test_obscpio_create_archive(self): tc_name = inspect.stack()[0][3] cl_name = self.__class__.__name__ c_dir = os.path.join(self.tmp_dir, tc_name) f_dir = os.path.join(self.fixtures_dir, tc_name, 'repo') shutil.copytree(f_dir, c_dir) scmlogs = ScmInvocationLogs('git', c_dir) scmlogs.next('start-test') # pylint: disable=E1102 fixture = GitFixtures(c_dir, scmlogs) fixture.init() scm_object = Git(self.cli, self.tasks) scm_object.clone_dir = fixture.repo_path scm_object.arch_dir = fixture.repo_path outdir = os.path.join(self.tmp_dir, cl_name, tc_name, 'out') self.cli.outdir = outdir arch = ObsCpio() os.makedirs(outdir) arch.create_archive( scm_object, cli = self.cli, basename = 'test', dstname = 'test', version = '0.1.1' )
def test_obscpio_broken_link(self): tc_name = inspect.stack()[0][3] cl_name = self.__class__.__name__ c_dir = os.path.join(self.tmp_dir, tc_name) scmlogs = ScmInvocationLogs('git', c_dir) scmlogs.next('start-test') # pylint: disable=E1102 fixture = GitFixtures(c_dir, scmlogs) fixture.init() scm_object = Git(self.cli, self.tasks) scm_object.clone_dir = fixture.repo_path scm_object.arch_dir = fixture.repo_path outdir = os.path.join(self.tmp_dir, cl_name, tc_name, 'out') cwd = os.getcwd() print("cwd = %s" % cwd) os.chdir(fixture.repo_path) os.symlink('non-existant-file', 'broken-link') fixture.run('add broken-link') fixture.run("commit -m 'added broken-link'") os.chdir(cwd) self.cli.outdir = outdir arch = ObsCpio() os.makedirs(outdir) arch.create_archive( scm_object, cli = self.cli, basename = 'test', dstname = 'test', version = '0.1.1' )
def test_obscpio_create_archive(self): tc_name = inspect.stack()[0][3] cl_name = self.__class__.__name__ c_dir = os.path.join(self.tmp_dir, tc_name) f_dir = os.path.join(self.fixtures_dir, tc_name, 'repo') shutil.copytree(f_dir, c_dir) scmlogs = ScmInvocationLogs('git', c_dir) scmlogs.next('start-test') fixture = GitFixtures(c_dir, scmlogs) fixture.init() scm_object = Git(self.cli, self.tasks) scm_object.clone_dir = fixture.repo_path scm_object.arch_dir = fixture.repo_path outdir = os.path.join(self.tmp_dir, cl_name, tc_name, 'out') self.cli.outdir = outdir arch = ObsCpio() os.makedirs(outdir) arch.create_archive( scm_object, cli = self.cli, basename = 'test', dstname = 'test', version = '0.1.1' )
def test_obscpio_broken_link(self): tc_name = inspect.stack()[0][3] cl_name = self.__class__.__name__ c_dir = os.path.join(self.tmp_dir, tc_name) scmlogs = ScmInvocationLogs('git', c_dir) scmlogs.next('start-test') fixture = GitFixtures(c_dir, scmlogs) fixture.init() scm_object = Git(self.cli, self.tasks) scm_object.clone_dir = fixture.repo_path scm_object.arch_dir = fixture.repo_path outdir = os.path.join(self.tmp_dir, cl_name, tc_name, 'out') cwd = os.getcwd() print("cwd = %s" % cwd) os.chdir(fixture.repo_path) os.symlink('non-existant-file', 'broken-link') fixture.run('add broken-link') fixture.run("commit -m 'added broken-link'") os.chdir(cwd) self.cli.outdir = outdir arch = ObsCpio() os.makedirs(outdir) arch.create_archive( scm_object, cli = self.cli, basename = 'test', dstname = 'test', version = '0.1.1' )
def test_obscpio_create_archive(self): tc_name = inspect.stack()[0][3] cl_name = self.__class__.__name__ scm_object = Git(self.cli, self.tasks) scm_object.clone_dir = os.path.join(self.fixtures_dir, tc_name, 'repo') scm_object.arch_dir = os.path.join(self.fixtures_dir, tc_name, 'repo') outdir = os.path.join(self.tmp_dir, cl_name, tc_name, 'out') self.cli.outdir = outdir arch = ObsCpio() os.makedirs(outdir) arch.create_archive( scm_object, cli = self.cli, basename = 'test', dstname = 'test', version = '0.1.1' )
def test_obscpio_create_archive(self): tc_name = inspect.stack()[0][3] cl_name = self.__class__.__name__ c_dir = os.path.join(self.tmp_dir, tc_name) f_dir = os.path.join(self.fixtures_dir, tc_name, 'repo') shutil.copytree(f_dir, c_dir) scmlogs = ScmInvocationLogs('git', c_dir) scmlogs.nextlog('start-test') fixture = GitFixtures(c_dir, scmlogs) fixture.init() scm_object = Git(self.cli, self.tasks) scm_object.clone_dir = fixture.repo_path scm_object.arch_dir = fixture.repo_path outdir = os.path.join(self.tmp_dir, cl_name, tc_name, 'out') self.cli.outdir = outdir arch = ObsCpio() os.makedirs(outdir) version = '0.1.1' (dst, chgv, bname) = self.tasks._dstname(scm_object, version) arch.create_archive( scm_object, cli = self.cli, basename = bname, dstname = dst, version = chgv ) cpiofile = os.path.join(outdir, "%s-%s.obscpio" % (bname, version)) infofile = os.path.join(outdir, bname + ".obsinfo") self.assertTrue(os.path.isfile(cpiofile)) self.assertTrue(os.path.isfile(infofile)) with io.open(infofile, 'r', encoding='UTF-8') as fhl: data = yaml.safe_load(fhl) self.assertDictEqual( data, { 'name': bname, 'version': chgv, 'mtime': 1234567890, 'commit': data['commit']})