Exemple #1
0
 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)
Exemple #2
0
 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)
Exemple #3
0
 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
     ])
Exemple #4
0
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)
Exemple #5
0
 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)
Exemple #6
0
 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)
Exemple #7
0
 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)
Exemple #8
0
 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)
Exemple #10
0
 def test_list_formats(self):
     run_checked([sys.executable, patool_cmd, "-vv", 'formats'])
Exemple #11
0
 def test_test(self):
     archive = os.path.join(datadir, "t .7z")
     run_checked([sys.executable, patool_cmd, "test", archive])
Exemple #12
0
 def test_list(self):
     archive = os.path.join(datadir, "t.tar")
     run_checked([sys.executable, patool_cmd, "-vv", "list", archive])
Exemple #13
0
 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])
Exemple #14
0
 def test_list_formats (self):
     run_checked([sys.executable, patool_cmd, "-vv", 'formats'])
Exemple #15
0
 def test_test(self):
     archive = os.path.join(datadir, "t .7z")
     run_checked([sys.executable, patool_cmd, "test", archive])
Exemple #16
0
 def search(self, pattern, archive):
     run_checked([sys.executable, patool_cmd, "-vv", "--non-interactive", "search", pattern, archive])
Exemple #17
0
 def search(self, pattern, archive):
     run_checked(
         [sys.executable, patool_cmd, "-vv", "search", pattern, archive])
Exemple #18
0
 def test_list_formats (self):
     run_checked([sys.executable, patool_cmd, "-vv", "--non-interactive", 'formats'])