def test_extract(self): tmpdir = util.tmpdir(dir=basedir) try: archive = os.path.join(datadir, "t .7z") util.run_checked([sys.executable, patool_cmd, "-vv", "extract", "--outdir", tmpdir, archive]) finally: shutil.rmtree(tmpdir)
def test_diff(self): archive1 = os.path.join(datadir, "t.tar") archive2 = os.path.join(datadir, "t.zip") run_checked([ sys.executable, patool_cmd, "-vv", "--non-interactive", "diff", archive1, archive2 ])
def run_archive_cmdlist (archive_cmdlist): """Run archive command.""" # archive_cmdlist is a command list with optional keyword arguments if isinstance(archive_cmdlist, tuple): cmdlist, runkwargs = archive_cmdlist else: cmdlist, runkwargs = archive_cmdlist, {} util.run_checked(cmdlist, **runkwargs)
def repack(self, name1, name2): """Repack archive with name1 to archive with name2.""" archive1 = os.path.join(datadir, name1) tmpdir = util.tmpdir() try: archive2 = os.path.join(tmpdir, name2) util.run_checked([sys.executable, patool_cmd, "-vv", "--non-interactive", "repack", archive1, archive2]) util.run_checked([sys.executable, patool_cmd, "--non-interactive", "diff", archive1, archive2]) finally: shutil.rmtree(tmpdir)
def repack(self, name1, name2): """Repack archive with name1 to archive with name2.""" archive1 = os.path.join(datadir, name1) tmpdir = util.tmpdir() try: archive2 = os.path.join(tmpdir, name2) util.run_checked([sys.executable, patool_cmd, "-vv", "repack", archive1, archive2]) util.run_checked([sys.executable, patool_cmd, "diff", archive1, archive2]) finally: shutil.rmtree(tmpdir)
def test_create(self): tmpdir = util.tmpdir(dir=basedir) try: files = [os.path.join(datadir, "t"), os.path.join(datadir, "t.txt")] archive = os.path.join(tmpdir, "t.7z") cmd = [sys.executable, patool_cmd, "-vv", "create", archive] cmd.extend(files) util.run_checked(cmd) finally: shutil.rmtree(tmpdir)
def recompress(self, name): """Recompress archive with given name.""" archive = os.path.join(datadir, name) ext = os.path.splitext(archive)[1] tmpfile = util.tmpfile(suffix=ext) try: shutil.copy(archive, tmpfile) util.run_checked([sys.executable, patool_cmd, "-vv", "--non-interactive", "recompress", tmpfile]) finally: if os.path.exists(tmpfile): os.remove(tmpfile)
def recompress(self, name): """Recompress archive with given name.""" archive = os.path.join(datadir, name) ext = os.path.splitext(archive)[1] tmpfile = util.tmpfile(suffix=ext) try: shutil.copy(archive, tmpfile) util.run_checked( [sys.executable, patool_cmd, "-vv", "recompress", tmpfile]) finally: if os.path.exists(tmpfile): os.remove(tmpfile)
def test_list_formats(self): run_checked([sys.executable, patool_cmd, "-vv", 'formats'])
def test_test(self): archive = os.path.join(datadir, "t .7z") run_checked([sys.executable, patool_cmd, "test", archive])
def test_list(self): archive = os.path.join(datadir, "t.tar") run_checked([sys.executable, patool_cmd, "-vv", "list", archive])
def test_diff (self): archive1 = os.path.join(datadir, "t.tar") archive2 = os.path.join(datadir, "t.zip") run_checked([sys.executable, patool_cmd, "-vv", "--non-interactive", "diff", archive1, archive2])
def test_list_formats (self): run_checked([sys.executable, patool_cmd, "-vv", 'formats'])
def search(self, pattern, archive): run_checked([sys.executable, patool_cmd, "-vv", "--non-interactive", "search", pattern, archive])
def search(self, pattern, archive): run_checked( [sys.executable, patool_cmd, "-vv", "search", pattern, archive])
def test_list_formats (self): run_checked([sys.executable, patool_cmd, "-vv", "--non-interactive", 'formats'])